Java Basics
Java Basics - Important Points
1. | What is Java? |
---|
A. A programming language
B. An operating system
C. A database management system
D. A web browser
View Answer Discuss Work SpaceAnswer: option a
Explanation:
Java is a programming language that is used to develop applications for a variety of platforms.
2. | Which of the following is NOT a primitive data type in Java? |
---|
A. int
B. boolean
C. double
D. string
View Answer Discuss Work SpaceAnswer: option d
Explanation:
3. | Which keyword is used to declare a variable in Java? |
---|
A. var
B. let
C. int
D. def
View Answer Discuss Work SpaceAnswer: option c
Explanation:
4. | What is the output of the following code? public class Test { public static void main(String args[]) { int x = 5; System.out.println(x++); } } |
---|
A. 4
B. 5
C. 6
D. 7
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The value of x is 5, and the post-increment operator (++) increments it after the value is printed.
5. | What is the output of the following code? public class Test { public static void main(String args[]) { System.out.println("Hello" + " World"); } |
---|
A. Hello
B. World
C. Hello World
D. HelloWorld
View Answer Discuss Work SpaceAnswer: option c
Explanation:
The + operator is used for concatenation in JavThe output is the concatenation of the two strings.