Java Basic Programs for Beginners
Java Basic Programs for Beginners - Important Points
16. | Which of the following is a valid way to create a new object in Java? |
---|
A. Object obj = new Object();
B. Object obj = Object();
C. Object obj = new Object;
D. Object obj = Object;
View Answer Discuss Work SpaceAnswer: option a
Explanation:
17. | What is the output of the following program? public class Main { |
---|
A. 1
B. 0
C. Compile error
D. Runtime error
View Answer Discuss Work SpaceAnswer: option a
Explanation:
18. | Which of the following is not a valid access modifier in Java? |
---|
A. private
B. public
C. protected
D. global
View Answer Discuss Work SpaceAnswer: option d
Explanation:
19. | What is the output of the following program? public class Main { |
---|
A. 1
B. 0
C. Compile error
D. Runtime error
View Answer Discuss Work SpaceAnswer: option a
Explanation:
20. | Which of the following is not a primitive data type in Java? |
---|
A. int
B. float
C. string
D. char
View Answer Discuss Work SpaceAnswer: option c
Explanation: