instanceof java
Posts: 576
Nickname: instanceof
Registered: Jan, 2015
instanceof java is a java related one.
Java Interview programming questions on this keyword
Posted: Jul 6, 2016 10:01 AM
This post originated from an RSS feed registered with Java Buzz
by instanceof java.
Original Post: Java Interview programming questions on this keyword
Feed Title: Instance Of Java
Feed URL: http://feeds.feedburner.com/blogspot/TXghwE
Feed Description: Instance of Java. A place where you can learn java in simple way each and every topic covered with many points and sample programs.
Latest Java Buzz Posts
Latest Java Buzz Posts by instanceof java
Latest Posts From Instance Of Java
Advertisement
Lets discuss some interesting programs on this keyword. Now its time to practice some programs on this keyword. Try to guess the output of the following java programming questions on this keyword. If you want explanations for all the programs please go through this keyword interview questions on java Java Quiz on this keyword part #1
Program #1: Java interview programming question on this keyword. package thiskeywordinterviewprograms.java; public class ThisDemo { int a; int b; ThisDemo(int a, int b){ a=a; b=b; } public static void main(String[] args) { ThisDemo obj = new ThisDemo(10, 20); System.out.println(obj.a); System.out.println(obj.b); } } Click for Output
Program #2: Java interview programming question on this keyword. package thiskeywordinterviewprograms.java; public class ThisDemo { int a; int b; ThisDemo(int a, int b){ this.a=a; this.b=b; } public static void main(String[] args) { ThisDemo obj = new ThisDemo(10, 20); System.out.println(obj.a); System.out.println(obj.b); } } Click for Output
Program #3: Java Interview programming example on this keyword. What will be the output of the below program package thiskeywordinterviewprograms.java; public class ThisDemo { int a; int b; ThisDemo(int a, int b){ this.a=a; this.b=b; } public static void main(String[] args) { ThisDemo obj = new ThisDemo(); System.out.println(obj.a); System.out.println(obj.b); } } Click for Output
Program #4: Java interview programming question on this keyword. Click for Output
Zero argument constructor called. Two argument constructor called. x=1 y=2
Read: Java Interview programming questions on this keyword