adplus-dvertising
frame-decoration

Question

Which of these is an incorrect string literal?

a.

“Hello World”

b.

“Hello\nWorld”

c.

“\”Hello World\””

d.

"Hello
world"

Answer: (d). "Hello
world"

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which of these is an incorrect string literal?

Similar Questions

Discover Related MCQs

Q. Which two cause a compiler error?

1. float[ ] f = new float(3);
2. float f2[ ] = new float[ ];
3. float[ ]f1 = new float[3];
4. float f3[ ] = new float[3];
5. float f5[ ] = {1.0f, 2.0f, 2.0f};

Q. Given a method in a protected class, what access modifier do you use to restrict access to that method to only the other members of the same class?

Q. Which is a valid declaration within an interface?

Q. You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective?

Q. Which three form part of correct array declarations?

1. public int a [ ]
2. static int [ ] a
3. public [ ] int a
4. private int a [3]
5. private int [3] a [ ]
6. public final int [ ] a

Q. public class Test { }

What is the prototype of the default constructor?

Q. What is the most restrictive access modifier that will allow members of one class to have access to members of another class in the same package?

Q. Which of the following is/are legal method declarations?

1. protected abstract void m1();
2. static final void m1(){}
3. synchronized public final void m1() {}
4. private native void m1();

Q. Which cause a compiler error?

Q. Which three are valid method signatures in an interface?

1. private int getArea();
2. public float getVol(float x);
3. public void main(String [] args);
4. public static void main(String [] args);
5. boolean setFlag(Boolean [] test);

Q. You want a class to have access to members of another class in the same package. Which is the most restrictive access that accomplishes this objective?

Q. Which one creates an instance of an array?

Q. Which two of the following are legal declarations for nonnested classes and interfaces?

1. final abstract class Test {}
2. public static interface Test {}
3. final public class Test {}
4. protected abstract class Test {}
5. protected interface Test {}
6. abstract public class Test {}

Q. Which of the following class level (nonlocal) variable declarations will not compile?

Q. Which three statements are true?

1. The default constructor initialises method variables.
2. The default constructor has the same access as its class.
3. The default constructor invokes the no-arg constructor of the superclass.
4. If a class lacks a no-arg constructor, the compiler always creates a default constructor.
5. The compiler creates a default constructor only when there are no other constructors for the class.

Q. What is the numerical range of char?

Q. Which of the following are Java reserved words?

1. run
2. import
3. default
4. implement

Q. Suppose that you would like to create an instance of a new Map that has an iteration order that is the same as the iteration order of an existing instance of a Map. Which concrete implementation of the Map interface should be used for the new instance?

Q. Which class does not override the equals() and hashCode() methods, inheriting them directly from class Object?

Q. Which collection class allows you to grow or shrink its size and provides indexed access to its elements, but whose methods are not synchronized?