Computer Applications
Which of the following is a valid statement to print the following sentence:
Raj said "Good morning"
- System.out.println("Raj said "Good morning");
- System.out.println("Raj said \\Good morning\\);
- System.out.println("Raj said \"Good morning\" ");
- System.out.println("Raj said Good morning");
Values & Data Types Java
1 Like
Answer
System.out.println("Raj said \"Good morning\" ");
Reason — The statement System.out.println("Raj said \"Good morning\" "); is valid because it uses the escape sequence \" to include double quotes inside the string. This ensures the output displays exactly as Raj said "Good morning".
Answered By
2 Likes
Related Questions
Which of the following is NOT true for polymorphism?
- All methods have the same name.
- Methods are invoked based on the arguments.
- Methods should have the same number and the same type of arguments.
- It is a principle of OOPs.
Which of the following is a valid initialisation statement?
- int x = "GOOD";
- int y = 45.0/2;
- int z = (int)'x';
- int m = false ;
Which data structure is represented in the below picture?

(i) A two-dimensional array with 2 rows and seven columns.
(ii) A one-dimensional array with 14 elements.- Both (i) and (ii)
- Only (i)
- Only (ii)
- None of the (i) and (ii)
What is the type of looping statement depicted in the below picture?

- Entry controlled loop
- Exit controlled loop
- Multiple branching statement
- All the above.