Title Lorem
Ipsum
SIT DOLOR AMET
Answer: 3,5
1.B( ) { }
2.B(int y ) { j = y; }
3.B(int y )
{ super(y*2 ); j = y; }
4.B(int y ) { i = y; j =
y*2; }
5.B(int z ) { this(z,
z); }
Answer: 3
1.0
2.1
3.2
4.-1
5.-2
6.3
7.X>a?(y>b?y:b) : (x>z?x:z)
Answer: 6
1.Code for interface House will cause
compilation to fail.
2.Code for interface Bungalow will cause
compilation to fail.
3.Code for class MyHouse will cause
compilation to fail.
4.Line at //1 will cause compilation to fail.
5.Line at //2 will cause compilation to fail.
6.The code will compile successfully.
Answer: 1
1.good bye friend!
2.good good good
3.goodgoodgood
4.good bye
5.None of the above.
You have written some Java code
in MyFirstClass.java file. Which of the following
commands will you use to compile and run it.
(Assume that the code has no package declaration.)
1.javac MyFirstClass.java
javar MyFirstClass
2.javap MyFirstClass.java
javar MyFirstClass.java
3.java MyFirstClass.java
java MyFirstClass.class
4.javac MyFirstClass.java
javar MyFirstClass.java
5.javac MyFirstClass.java
java MyFirstClass
Answer: 2,3,4
1.System.out.println(f.name);
2.System.out.println(f.getName());
3.System.out.println(((Eagle)f).na
me);
4.System.out.println(((Bird)f).get
Name());
5.System.out.println(Eagle.name);
6.System.out.println(Eagle.getName
(f));
Answer: 5
1.0 followed by 100.
2.100 followed by 100.
3.0 followed by 200.
4.100 followed by 200.
5.200 followed by 200.
6.200 followed by 100
Answer: 3
1.int, int
2.int, double
3.double, double
4.double, int
5.Nothing, they are simply not
compatible.
Answer: 2
1.No change is necessary.
2.Replace System.out.print(k); with
System.out.print(k--);
3.Replace System.out.print(k); with
System.out.print(--k);
4.Replace while(checkIt(k)) with w
hile(checkIt(--k)).
5.Replace return k-->0?
true:false; with return this.k-->0?
true:false;
Answer: 2
1.i=6 j=6
2.i=5 j=6
3.i=5 j=5
4.i=6 j=5
5.None of these.
Answer: 1
1.It will not compile.
2.false
3.true
false
4.Exception at run time.
Answer:
1.2
2.3
3.4
4.5
5.6
Answer: 4
1.10 9
2.10 10
3.6 9
4.6 10
5.5 11
Answer: 1
1.In Number
2.In Object
3.In Long
4.In Integer
5.It will not compile.
1.Baap 44
4 44
Beta 44
44 44
2.Beta 44
4 44
Baap 44
44 44
3.Beta 44
4 44
Beta 44
44 44
4.4 44
Beta 44
44 44
Beta 44
5.44 44
Beta 44
4 44
Beta 44
6.4 44
Beta 44
4 44
Beta 44
1.array2 = array3;
2.array2 = array4;
3.array1 = array2;
4.array4 = array1;
5.array5 = array3;
1.It will not compile.
2.It will throw an exception at
runtime.
3.It will print numbers from 0 to 8
4.It will print numbers from 0 to 3
5.It will print numbers from 0 to 4
1.the base field
2.the height field
3.the area field
4.the Triangle constructor
5.the setBase method
6.the setHeight method
Các method trên method nào là
override vs overload?
Thêm final, static vô line 2 được
ko?
Thêm final vs static vô line 3 hoặc
6 được ko?
Which of the following statements
are true?
Cách triển khai hashcode nào là
đúng ?