1.Choose the correct answer
What is the output of the following Java program?
public class Main {
public static void main(String[] args) {
int x = 5;
int y = 10;
System.out.println(x + y);
}
}
Ans. 15.
2. What is the correct way to declare a variable in Java?
Ans. int x=5;
3. What is the output of the following Java program?
public class Main {
public static void main(String[] args) {
String message = “Hello, World!”;
System.out.println(message);
}
}
Ans. Hello, World!
