Java find output programs
- Java find output programs (Data Types) | set 1
- Java find output programs (Data Types) | set 2
- Java find output programs (Data Types) | set 3
- Java find output programs (Operators) | set 1
- Java find output programs (Operators) | set 2
- Java find output programs (Operators) | set 3
- Java find output programs (if else) | set 1
- Java find output programs (if else) | set 3
- Java find output programs (switch case) | set 1
- Java find output programs (switch case) | set 2
- Java find output programs (switch case) | set 3
- Java find output programs (Loops) | set 1
- Java find output programs (Loops) | set 2
- Java find output programs (Loops) | set 3
- Java find output programs (Arrays) | set 1
- Java find output programs (Arrays) | set 2
- Java find output programs (Arrays) | set 3
- Java find output programs (this Keyword) | set 1
- Java find output programs (final Keyword) | set 1
- Java find output programs (final Keyword) | set 2
- Java find output programs (static Keyword) | set 1
- Java find output programs (static Keyword) | set 2
- Java find output programs (Parameter Passing) | set 1
- Java find output programs (Class and Objects) | set 1
- Java find output programs (Class and Objects) | set 2
- Java find output programs (Class and Objects) | set 3
- Java find output programs (Constructor & Destructor) | set 1
- Java find output programs (Constructor & Destructor) | set 2
- Java find output programs (Constructor & Destructor) | set 3
- Java find output programs (Inheritance) | set 1
- Java find output programs (Inheritance) | set 2
- Java find output programs (Inheritance) | set 3
- Java find output programs (Interface) | set 1
- Java find output programs (Interface) | set 2
- Java find output programs (Interface) | set 3
- Java find output programs (Overloading) | set 1
- Java find output programs (Overloading) | set 2
- Java find output programs (Overriding) | set 1
- Java find output programs (Overriding) | set 2
- Java find output programs (Overriding) | set 3
- Java find output programs (Exception Handling) | set 1
- Java find output programs (Exception Handling) | set 2
- Java find output programs (Exception Handling) | set 3
- Java find output programs (Enumeration) | set 1
- Java find output programs (Enumeration) | set 2
- Java find output programs (Autoboxing & Unboxing) | set 1
- Java find output programs (Autoboxing & Unboxing) | set 2
- Find output programs (Java String class)
- Find Output of Java program - 1 (Mixed topics)
- Find Output of Java program - 2 (Mixed topics)
- Java find output programs (if else) | set 2
Answer Question 1:
Output:
Explanation:
The above program will generate a syntax error because the if condition in Java required boolean value. In the if condition, we assign variable num with 101. The condition will be:
if(101)
We cannot use integer value for conditions in Java.
Answer Question 2:
Output:
Explanation:
In the above program, we created a class Main that contains a main() method, the main() method is the entry point of the program, here we declared three integer variables A, B, and C initialized with 10, 20, 30.
Now evaluate the expression:
C = ++A * --B + C;
First, evaluate ++A, then A becomes 11, and then evaluate --B, then B becomes 19.
C = A *B + C; C = 11*19+30; C = 209+30 C = 239
Let's check the condition given below,
if (A==(++B*2)) if (A==(20*2)) if (A==400)
A contains 11 then the if condition will false that's why "Hiii: 239" will be printed on the console screen.
Answer Question 3:
Output:
Explanation:
In the above program, we created a class Main that contains a main() method, the main() method is the entry point of the program, here we declared two variables A and B that are initialized with "2.34F" and "2.34" respectively.
Here, A is float type, and B is double type then both numbers will not equal then condition get false and www.google.com will print on the console screen.
Answer Question 4:
Output:
Explanation:
The above program will generate a syntax error because we cannot compare the integer variable with null.
Answer Question 5:
Output:
Explanation:
In the above program, we created a class Main that contains a main() method, the main() method is the entry point of the program, here we declared two variables NUM and STR that are initialized with 0 and "Hello World" respectively.
NUM = STR.length();
Here, STR.Length() method will return 11 and assigned to the variable NUM.
if (NUM%2==0) if (11%2==0)
In the above condition, we will get remainder 1, and then the condition gets false and print "NUM is ODD number" on the console screen.
need an explanation for this answer? contact us directly to get an explanation for this answer