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:
In the above program, we created a class Main that contains the main() method. The main() method is the entry point of the program. Here, we created three variables ret, a, and pi, that are initialized with "false", "20", and "3.14" respectively.
ret = (a==20)&&(3.14F==pi);
In the above expression, first condition (a==20) will be true, but the second condition (3.14F==pi) will false, because pi is the double type and 3.14F is float type. Both are not equivalent to each other in Java.
Then the final value of ret that is false will be printed on the console screen.
Answer Question 2:
Output:
Explanation:
In the above program, we created a class Main that contains the main() method. The main() method is the entry point of the program. Here, we created four variables ret, a, b, and str that are initialized with false, 20, 0, and www.includehelp.com respectively.
ret = (a==20)||((b>=str.length())?true:false); ret = True||((b>=str.length())?true:false);
Let's evaluate the expression,
In case of "||" operator, if first condition is True the second will not check. So finally True is assigned to variable ret and will be printed on the console screen.
Answer Question 3:
Output:
Explanation:
In the above program, we created a class Main that contains the main() method. The main() method is the entry point of the program. Here, we created a variable ret which is initialized with true.
System.out.println(ret&=true);
Let's evaluate the expression used in println() method,
ret &=true; ret =ret &true; ret =true &true; ret = true;
Then finally true will be printed on the console screen.
Answer Question 4:
Output:
Explanation:
The above program will generate a syntax error because the typeof() method or operator does not exist in Java.
Answer Question 5:
Output:
Explanation:
The above program will generate errors because we cannot use the comma ',' operator for value assignment like this. We use this kind of assignment in C and C++ languages.
need an explanation for this answer? contact us directly to get an explanation for this answer