Java 11 Certification Dumps for 1Z0-815 latest 2020 Set 6

Which three members of the given class must be declared as private to ensure the data integrity of a Rectangle object?
public class Rectangle {
    int width;
    int height;
    int area;
    void setWidth(int width) {
        this.width = width;
        setArea();
    }
    void setHeight(int height) {
        this.height = height;
        setArea();
    }
    int getArea() {
        return area;
   }
    void setArea() {
        area = width * height;
    }
}


Options are :

  • Field width (Correct)
  • Field height (Correct)
  • Field area (Correct)
  • Method setWidth
  • Method setHeight
  • Method getArea

Answer :Field width Field height Field area

int i1 = 0b2;
int i2 = 0o2;
int i3 = 0d2;
int i4 = 0x2;

Which variable declarations are valid?


Options are :

  • i1 only
  • i2 only
  • i3 only
  • i4 only (Correct)
  • i1 and i4
  • i2 and i3

Answer :i4 only

What is the given program's output?
class Foo {
    Foo(String text) {
        System.out.println(text);
    }
}
public class Test {
    static public void main(String[] args) {
        new Test();
    }
    Foo foo1 = new Foo("hi");
    static Foo foo2 = new Foo("hey");
}


Options are :

  • hi
  • hey
  • hi hey
  • hey hi (Correct)
  • Nothing

Answer :hey hi

Which two of the following expressions can be inserted into the given code to make it able to compile?
public class Test {
    boolean verify(List<Integer> list, Predicate<List> predicate) {
        return predicate.test(list);
    }
    public static void main(String[] args) {
        Test test = new Test();
        var list = List.of(1, 2, 3, 4);
        var result = /* Insert here */;
        System.out.println(result);
    }
}


Options are :

  • test.verify(list, List::isEmpty) (Correct)
  • test.verify(list, i -> i > 0)
  • test.verify(list, i -> i.toArray())
  • test.verify(list, i -> i.add(5)) (Correct)
  • test.verify(list, l -> l.clear())

Answer :test.verify(list, List::isEmpty) test.verify(list, i -> i.add(5))

Which of the interfaces I1, I2 and I3 can be inserted into the check method to make it able to compile?
interface I1 {
    boolean m(Integer i1, Integer i2);
   boolean m(long l1, long l2);
}
interface I2 {
    static boolean m(int i1, int i2) {
        return i1 == i2;
    }
}
interface I3 {
    boolean m(Integer i1, Integer i2);
    static boolean m(long l1, long l2) {
        return l1 == l2;
   }
}
public class Test {
    boolean check(int i1, int i2, /* Insert here */ func) {
        return func.m(i1, i2);
    }
}


Options are :

  • I1 only (Correct)
  • I2 only
  • I3 only
  • I1 or I2
  • I1 or I3
  • I2 or I3

Answer :I1 only

Given a module with two packages com and com.whizlabs. Which of the following statement is correct?


Options are :

  • If the com package is exported, the com.whizlabs package is exported automatically
  • If the com.whizlabs package is exported, the com package is exported automatically
  • If we want to export the com.whizlabs package, we must explicitly export the com package as well
  • None of the above (Correct)

Answer :None of the above

What is the program's output?
package foo;
public class Greeting {
    public String say() {
       return "Foo";
    }
}
And:
package bar;
public class Greeting {
    public String say() {
        return "Bar";
    }
}
And:
package test;
import foo.Greeting;
import bar.Greeting; // Line 1
public class MyTest {
    public static void main(String[] args) {
        Greeting greeting = new Greeting(); // Line 2
        System.out.println(greeting.say());
    }
}


Options are :

  • Foo
  • Bar
  • Either Foo or Bar
  • Compilation fails on line 1 (Correct)
  • Compilation fails on line 2

Answer :Compilation fails on line 1

Which of the following can be inserted into the given method?
String select(Integer input) {
    switch (input) {
        // Insert here
            return String.valueOf(input);
        default:
            return null;
    }
}


Options are :

  • case:
  • case 1 + 0: (Correct)
  • case 1i:
  • case new Integer(1):
  • None of the above

Answer :case 1 + 0:

int[] a1 = {1, 2};
int[] a2 = Arrays.copyOf(a1, 2);
Arrays.fill(a2, 3);
System.out.println(Arrays.toString(a1));

What is the output of the given code fragment?


Options are :

  • [1, 2] (Correct)
  • [1, 3]
  • [3, 3]
  • An ArrayIndexOutOfBoundsException is thrown
  • Compilation fails

Answer :[1, 2]

What happens when compiling and executing the given code fragment?
StringBuilder builder = new StringBuilder(1);
String string = builder.toString();
System.out.println(string.charAt(0));


Options are :

  • It prints "1"
  • It prints "null"
  • It prints nothing
  • It throws an exception (Correct)
  • Compilation fails

Answer :It throws an exception

Which line of code causes a compile-time error?
public class Test {
    void methodA() throws ArithmeticException {
// Line 1
        throw new RuntimeException()
// Line 2
    }
    void methodB() throws IOException {
// Line 3
        methodA()
// Line 4
    }
    public static void main(String[] args) {
        Test test = new Test();
        try {
            test.methodA()
// Line 5
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
    }
}


Options are :

  • Line 1
  • Line 2
  • Line 3
  • Line 4
  • Line 5
  • Compilation succeeds (Correct)

Answer :Compilation succeeds

What is the program's output?
package foo;
public class MyFoo {
    String text = "Foo";
    protected void printText() {
       System.out.println(text);
    }
}
And:
package bar;
import foo.MyFoo;
public class MyBar extends MyFoo {
    private String text = "Bar"
// Line 1
    public static void main(String[] args) {
        MyBar myBar = new MyBar();
        myBar.printText()
// Line 2
        System.out.println(myBar.text)
// Line 3
    }
}


Options are :

  • Foo; ; Foo
  • Foo; ; Bar (Correct)
  • Bar; ; Foo
  • Bar; ; Bar
  • Compilation fails on line 1
  • Compilation fails on line 2

Answer :Foo; ; Bar

What is the program's output?
class Data {
    int number;
    Data(int number) {
        this.number = number;
    }
}
public class Test {
    Data data1 = new Data(1);
    Data data2 = new Data(2);
   Data[] getData() {
        return new Data[]{data1, data2};
    }
    public static void main(String[] args) {
        Test test = new Test();
        --test.getData()[1].number;
        Data[] data = test.getData();
        int number1 = (data[0]).number;
        int number2 = (data[1]).number;
        System.out.println(number1 + " and " + number2);
    }
}


Options are :

  • 0 and 2
  • 1 and 1 (Correct)
  • 1 and 2
  • An exception is thrown
  • Compilation fails

Answer :1 and 1

What is the given program's output?
package test;
class Integer { // Line 1
    Integer number;
   Integer(Integer number) {
       this.number = number;
    }
}
public class Test {
    public static void main(String[] args) {
        Integer integer = new Integer(1); // Line 2
        System.out.println(integer.equals(1)); // Line 3
    }
}


Options are :

  • TRUE
  • FALSE
  • Compilation fails on line 1
  • Compilation fails on line 2 (Correct)
  • Compilation fails on line 3

Answer :Compilation fails on line 2

Double d = 1.5;

++d;

System.out.println(d);

What happens when compiling and executing the given code fragment?


Options are :

  • It fails to compile as the pre-increment operator cannot apply to a Double object
  • It throws an ArithmeticException at runtime
  • It prints out number 1.5
  • It prints out number 2.0
  • It prints out number 2.5 (Correct)

Answer :It prints out number 2.5

What is the program's output?
public class Test {
    public static void main(String[] args) {
        Test test = new Test();
        test.loop(0);
    }
   void loop(int number) {
        do {
            if (number % 2 != 0) break; // Line 1
        } while (number++ > 0); // Line 2
        System.out.println(number);
    }
}


Options are :

  • 0
  • 1 (Correct)
  • 2
  • Nothing
  • Compilation fails on line 1
  • Compilation fails on line 2

Answer :1

Which of the following changes must be made to allow the given code to compile?
public class Test {
    static void methodA() {
        methodB(); // Line 1
    }
    void methodB() {
        methodC(); // Line 2
    }
    static void methodC() {
        System.out.println("Hello");
    }
}


Options are :

  • Replace line 1 with this.methodB();
  • Replace line 1 with new Test().methodB(); (Correct)
  • Replace line 2 with this.methodC();
  • Replace line 2 with Test.methodC();
  • Both options A and D
  • Both options B and C

Answer :Replace line 1 with new Test().methodB();

Which two changes enable when made independently enable the given program to compile?
class MyException extends Exception /* Position 1 */ {
    /* Position 2 */
}
public class Test {
    static void methodA() throws MyException /* Position 3 */ {
        throw new MyException();
    }
    static void methodB() /* Position 4 */ {
        methodA();
    }
    public static void main(String[] args) /* Position 5 */ {
        try {
           methodB();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}


Options are :

  • Replace Exception at position 1 with RuntimeException (Correct)
  • Insert super("") at position 2
  • Replace MyException at position 3 with Exception
  • Insert throws MyException at position 4 (Correct)
  • Insert throws Throwable at position 5

Answer :Replace Exception at position 1 with RuntimeException Insert throws MyException at position 4

Which of the following method can be inserted into the Bar class?
interface I { /* a valid body */ }
class C1 implements I { /* a valid body */ }
class C2 extends C1 { /* a valid body */ }
class Foo {
    protected C1 get() { /* a valid body */ }
}
abstract class Bar extends Foo {    // Insert here
}


Options are :

  • public C1 get();
  • public abstract C2 get(); (Correct)
  • public I get() { /* a valid body */ }
  • protected abstract I get();
  • protected static C1 get() { /* a valid body */ }
  • C2 get() { /* a valid body */ }

Answer :public abstract C2 get();

What's the program's output?
public class Person {
    final String name;
    void setName() {
        name = "John";
    }
    public static void main(String[] args) {
        Person person = new Person();
        person.setName();
        System.out.println(person.name);
    }
}


Options are :

  • null
  • John
  • An exception is thrown
  • Compilation fails (Correct)

Answer :Compilation fails

Which two declarations are invalid?
float f1 = 1.0;
float f2 = 1e0;
float f3 = 1;
float f4 = 1.0f;
float f5 = 0x1F;
float f6 = 1L;
var f7 = 1.1;


Options are :

  • f1 (Correct)
  • f2 (Correct)
  • f3
  • f4
  • f5
  • f6

Answer :f1 f2

How many objects are created when the given statement is executed?
String s = "Hello" + " " + "World!";


Options are :

  • 1 (Correct)
  • 2
  • 3
  • 4
  • 5
  • 6

Answer :1

What is the output of the given code?
int i, j;
for (i = j = 0; ; ++i, j--) {
    if (i - j > 10) {
        break;
    }
}
System.out.println(i + " " + j);


Options are :

  • 43622 (Correct)
  • 43590
  • 43559
  • It runs into an infinite loop
  • Compilation fails

Answer :43622

Given a code fragment:

What is the output when the code is run?
byte b = (byte) 'b';
b++;
short s = b;
System.out.println(s - 1);


Options are :

  • 98
  • Compilation fails (Correct)
  • An ArithmeticException is thrown

Answer :Compilation fails

What is the output when executing the code fragment?
double x = 3, y = 2;
double z = x % y;
System.out.println(z);


Options are :

  • 1
  • 1.0 (Correct)
  • An ArithmeticException is thrown
  • Compilation fails

Answer :1.0

Which of the following is not an advantage of exception handling?


Options are :

  • Separating exception handling code from regular code
  • Propagating exceptions up the call stack
  • Grouping and differentiating exception types
  • Recovering the program in the event of a failure (Correct)
  • None of the above

Answer :Recovering the program in the event of a failure

Which method can be declared within the Bar class to make it compile?
interface Foo {
    void myMethod();
}
public class Bar implements Foo {
    // method declarations
}


Options are :

  • public abstract void myMethod();
  • protected void myMethod() { // a valid body };
  • private void myMethod() { // a valid body }
  • void myMethod() { // a valid body }
  • None of the above (Correct)

Answer :None of the above

What is the output of the program?
public class Test {
    String concatWithMethod(String[] array) {
        return array[0].concat(array[1]);
    }
   String concatWithOperator(String[] array) {
        return array[0] + array[1];
    }
    public static void main(String[] args) {
        Test test = new Test();
        String[] array = new String[2];
        String result1 = test.concatWithMethod(array);
        String result2 = test.concatWithOperator(array);
        System.out.println(result1 == result2);
    }
}


Options are :

  • TRUE
  • FALSE
  • An exception is thrown at runtime (Correct)
  • Compilation fails

Answer :An exception is thrown at runtime

What is the output when executing the given code?
int[] array1 = {1, 2, 3, 4};
int[] array2 = new int[5];
for (int i = 0; i < array1.length; i++) {
    array2[i] = array1[i];
}
System.out.println(array2[4]);


Options are :

  • 0 (Correct)
  • 4
  • An ArrayIndexOutOfBoundsException is thrown
  • A NullPointerException is thrown

Answer :0

What is the program's output?
class Foo {
    public String text = "Hello";
    public static String myMethod() {
        return new Foo().text;
    }
}
public class Bar extends Foo {
    static String text = "Bonjour";
  static String myMethod() {
        return text;
    }
    public static void main(String[] args) {
        Foo foo = new Bar();
        System.out.println(foo.text);
        System.out.println(foo.myMethod());
    }
}


Options are :

  • Hello Hello
  • Hello Bonjour
  • Bonjour Hello
  • Bonjour Bonjour
  • Compilation fails (Correct)

Answer :Compilation fails

What is the result?
try {
    throw new IOException();
} catch (RuntimeException | IOException e) { // Line 1   
if (e instanceof IOException) {
        e = new RuntimeException(e); // Line 2
        throw e;
    }
}


Options are :

  • A RuntimeException is thrown up the call stack
  • An IOException is thrown up the call stack
  • Compilation fails on line 1
  • Compilation fails on line 2 (Correct)

Answer :Compilation fails on line 2

Which number when inserted at position 1 makes the given code print true to the console?
StringBuilder builder1 = new StringBuilder(/* Position 1 */);
StringBuilder builder2 = new StringBuilder("Hello");
int cap1 = builder1.capacity();
int cap2 = builder2.capacity();
System.out.println(cap1 == cap2);


Options are :

  • 5
  • 16
  • 21 (Correct)
  • It's impossible as the JVM automatically allocates capacity for a StringBuilder

Answer :21

What is the output of the program?
public class Test {
    String base = "a";
    public Test() {
        base = appendString(base, "b");
    }
    {
        base = appendString(base, "c");
    }
   String text = appendString(base, "d");
    private String appendString(String base, String appended) {
        return base + appended;
    }
    public static void main(String[] args) {
        Test test = new Test();
        System.out.println(test.text);
    }
}


Options are :

  • abcd
  • abd
  • acd (Correct)
  • ad
  • bd
  • bcd

Answer :acd

Which line of code causes a compile-time error?
interface Foo {
    void methodA();
}
class Bar {
    void methodB() {
        // a valid body
    }
}
abstract class Baz extends Bar implements Foo { // Line 1
    @Override // Line 2
    public abstract void methodA(); // Line 3
    @Override // Line 4
    public abstract void methodB(); // Line 5
}


Options are :

  • Line 1
  • Line 2
  • Line 3
  • Line 4
  • Line 5
  • None of the above (Correct)

Answer :None of the above

What is the program's output?
class Foo {
    Foo(String input) {
        System.out.print(input + " ");
    }
    static {
        System.out.print("hello ");
    }
}
public class Test {
    static public void main(String[] args) {
        Foo foo1 = new Foo("hi");
        Foo foo2 = new Foo("hey");
    }
    static {
        System.out.print("bye ");
    }
}


Options are :

  • hi hey
  • hi hey hello
  • hi hey hello hello
  • hi hey hello bye
  • hello hi hey
  • bye hello hi hey (Correct)

Answer :bye hello hi hey

What is the given code's output?
double x = 1, y = -2, z = 3;
double t = x / y % (z + (x - y)) * z;
System.out.println(t);


Options are :

  • -1.5 (Correct)
  • 3.5
  • 6.5
  • An ArithmeticException is thrown
  • Compilation fails

Answer :-1.5

What is the output?
String string = "Pa ma pa";
int index1 = string.indexOf('p');
int index2 = string.indexOf('a', index1);
System.out.println(index2);


Options are :

  • 1
  • 4
  • 7 (Correct)
  • An IndexOutOfBoundsException is thrown
  • Compilation fails

Answer :7

Which command generates a module-info.java file?


Options are :

  • java --generate-module
  • javac -g
  • javac --module-info
  • jdeps --generate-module
  • jdeps --generate-module-info (Correct)

Answer :jdeps --generate-module-info

What is the output of the given code?
int sum = 0;
myLabel:
do {
    for (int i = 0; i < 5; i++) {
        if (i % 2 == 0) continue;
        sum += i;
    }
} while (sum < 15);
System.out.println(sum);


Options are :

  • 0
  • 4
  • 6
  • 10
  • 16 (Correct)
  • It runs into an infinite loop

Answer :16

Which two variables are set to false after the given code fragment is executed?
boolean b1 = new StringBuilder("hello").equals("hello");
boolean b2 = new StringBuilder("he").append("llo")
        .equals(new StringBuilder("hello"));
boolean b3 = new String(" hello ").strip().equalsIgnoreCase("hello");
boolean b4 = ("he" + "llo").toUpperCase().equals("HELLO");
boolean b5 = "heLLO".equalsIgnoreCase("HEllo");


Options are :

  • b1 (Correct)
  • b2 (Correct)
  • b3
  • b4
  • b5

Answer :b1 b2

Given two source files:
package foo;
public class MyFoo {
    // a valid body
}
And:
package foo.bar;
public class MyBar {
    // a valid body
}

These files are put is this directory hierarchy:

foo

MyFoo.java

bar

MyBar.java

What is the correct way to compile both source files?


Options are :

  • Run javac foo/* in the parent of the foo directory
  • Run javac foo/* foo/bar/* in the parent of the foo directory
  • Run javac MyFoo.java;bar/MyBar.java in the foo directory
  • Run javac ../MyFoo.java MyBar.java in the bar directory (Correct)
  • None of the above

Answer :Run javac ../MyFoo.java MyBar.java in the bar directory

Which two of the following are correct about the Java Platform Module System (JPMS)?


Options are :

  • With JPMS, an application can run on either the classpath or the module path, but not both
  • A module is a set of packages that make sense being grouped together and is designed for reuse (Correct)
  • JPMS makes applications more reliable, easier to maintain and secure (Correct)
  • Public interfaces are visible outside of its module, while public classes aren't
  • We can selectively expose some public types in a package to other modules while keeping other types for internal use

Answer :A module is a set of packages that make sense being grouped together and is designed for reuse JPMS makes applications more reliable, easier to maintain and secure

Which three lines fail to compile?
abstract class Foo {
    protected static int x;
    private String y;
    abstract void methodA();
    final void methodB() { }
}
class Bar extends Foo { // Line 1
    int y; // Line 2
    static String x; // Line 3
   @Override // Line 4
    public void methodA(String s) { }
   public void methodB() {} // Line 5
}


Options are :

  • Line 1 (Correct)
  • Line 2
  • Line 3
  • Line 4 (Correct)
  • Line 5 (Correct)

Answer :Line 1 Line 4 Line 5

What is the output of the given code fragment?
String[] array1 = {"1", "2", "3"};
String[] array2 = {};; String[] array3 = null;
Object o1 = Arrays.compare(array1, array2);
Object o2 = Arrays.compare(array2, array3);
Object o3 = Arrays.compare(array3, array1);
System.out.println(o1 + " " + o2 + " " + o3);


Options are :

  • 0 null null
  • 1 0 -1
  • 3 0 null
  • 3 1 -1 (Correct)
  • A NullPointerException is thrown
  • Compilation fails

Answer :3 1 -1

What is the program's output?
public class Test {
    static public void main(String[] args) {
        Test test = new Test();
        test.checkBoolean(true);
    }
    void checkBoolean(boolean value) {
        switch (value) {
           default: System.out.println("false");
            case Boolean.TRUE: System.out.println("true");
        }
    }
}


Options are :

  • TRUE
  • FALSE
  • TRUE FALSE
  • FALSE TRUE
  • Compilation fails (Correct)

Answer :Compilation fails

What it the program's output?
public class Test {
    int i1;
    Integer i2;
    public static void main(String[] args) {
        Test test = new Test();
       int sum = 0;
        try {
            sum = test.i1++ + test.i2++;
        } catch (Exception e) { }
        System.out.println(test.i1 + " " + test.i2);
    }
}


Options are :

  • 0 0
  • 0 1
  • 0 null
  • 1 0
  • 1 1
  • 1 null (Correct)

Answer :1 null

What is the program's output?
public class Person {
    String fullName;
    public Person(String... nameParts) {
        if (nameParts == null) throw new StringIndexOutOfBoundsException();
        if (nameParts.length > 2) throw new ArrayIndexOutOfBoundsException();
        if (nameParts.length == 2) fullName = nameParts[0] + nameParts[1];
        else fullName = nameParts[0];
    }
}
And:
public class Test {
    static public void main(String[] args) {
        Person person = new Person(null, null);
        System.out.println(person.fullName);
    }
}


Options are :

  • null
  • nullnull (Correct)
  • Nothing
  • A NullPointerException is thrown
  • A StringIndexOutOfBoundsException is thrown
  • An ArrayIndexOutOfBoundsException is thrown

Answer :nullnull

What is the output when executing the given code?
int[][] matrix = new int[2][];
matrix[0] = new int[]{1, 2};
int sum = 0;
for (int i = 0; i < matrix.length; i++) {
    for (int j = 0; j < matrix[i].length; j++) {
        sum += matrix[i][j];
   }
}
System.out.println(sum);


Options are :

  • 3
  • 6
  • A NullPointerException is thrown (Correct)
  • Compilation fails

Answer :A NullPointerException is thrown

What is the output of the given code fragment?
List list = new ArrayList<>();
list.addAll(List.of("A"));
list.add(2, "B");
System.out.println(list);


Options are :

  • [A, B]
  • [A, null, B]
  • An IndexOutOfBoundsException is thrown (Correct)
  • A NullPointerException is thrown
  • Compilation fails

Answer :An IndexOutOfBoundsException is thrown

What is the program's output?
package foo;
public class Greeting {
    public String say() {
        return "Foo";
    }
}
And:
package bar;
public class Greeting {
    public String say() {
        return "Bar";
    }
}
And:
package test;
import foo.*;
import bar.Greeting; // Line 1
public class MyTest {
    public static void main(String[] args) {
        Greeting greeting = new Greeting(); // Line 2
        System.out.println(greeting.say());
    }
}


Options are :

  • Foo
  • Bar (Correct)
  • Either Foo or Bar
  • Compilation fails on line 1
  • Compilation fails on line 2

Answer :Bar

What is the output?
String text = "ab";
text = text.repeat(2);
text = text.replace('a', 'c');
text = text.replace("b", "d");
System.out.println(text);


Options are :

  • cadb
  • ccdd
  • cdab
  • cdcd (Correct)
  • Compilation fails

Answer :cdcd

What is the program's output?
public class Test {
    int x; // Line 1
    public static void main(String[] args) {
        Test test = new Test();
        if (!test.x) { // Line 2
           System.out.println("x = 0");
        } else {
            System.out.println("x != 0");
        }
    }
}


Options are :

  • x = 0
  • x != 0
  • Compilation fails on line 1
  • Compilation fails on line 2 (Correct)

Answer :Compilation fails on line 2

What is the program output?
public class Test {
   void printMessage(short argument) {
        System.out.println("Argument is short");;
   }
    void printMessage(Integer argument) {
        System.out.println("Argument is Integer");
    }
    void printMessage(long argument) {
        System.out.println("Argument is long");
    }
    public static void main(String[] args) {
        Test test = new Test();
        test.printMessage(1);
    }
}


Options are :

  • Argument is short
  • Argument is Integer
  • Argument is long (Correct)
  • Compilation fails

Answer :Argument is long

What is the program's output?
public class Test {
    public static void main(String[] args) {
        try {
            Test test = new Test();
            test.isZero(1);
            System.out.println("try");
        } catch (Exception e1) {
          try {
                throw new ArithmeticException();
           } catch (RuntimeException e2) {
                System.out.println("catch");
            }
        } finally {
           System.out.println("finally");
       }
    }
    void isZero(int input) {
        if (input != 0)
            throw new RuntimeException();
    }
}


Options are :

  • try
  • try catch
  • try catch finally;
  • try finally
  • try finally catch
  • catch finally (Correct)

Answer :catch finally

What is the program's output?
public class Test {
    static String text = "foo";
    public static void main(String[] args) {
        if (!text.equals("Foo")) {
            String text = "bar";
        } else {
            String text = "baz";
        }
        System.out.println(text);
    }
}


Options are :

  • foo (Correct)
  • bar
  • baz
  • Compilation fails

Answer :foo

Which of the following is not a feature of the Java language?


Options are :

  • Architecture neutral
  • Portable
  • Interpreted
  • Multithreaded
  • Dynamic
  • Centralized (Correct)

Answer :Centralized

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions