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 syntax errors because here we assigned double values to local variables A and C. By default a floating-point number is double type, here we need to use character 'F' in suffix to represent number of float type.
The correct way is given below:
float A=2.3F; float C=0.0F;
Answer Question 2:
Output:
Explanation:
The above program will generate a syntax error because of below statement,
C = A*B-4;
In the above statement after evaluating the expression result will be float type but we are assigning result to the integer variable C.
The correct expression will be:
C = (int)A*B-4;
Answer Question 3:
Output:
Explanation:
The above program will generate syntax error. In Java variable of byte type occupies 1 byte in memory. The maximum value of byte type variable is 255.
C = A*B;
In the above expression multiplication of 10 and 30 will be 300 that cannot be assigned in variable C because C is byte type.
Answer Question 4:
Output:
Explanation:
The above program will generate error because return type of printf() method is PrintStream that cannot be converted into integer value.
Answer Question 5:
Output:
Explanation:
The above program will generate syntax errors because long int and short int cannot not be used in Java. If we want to declare a variable of short type then we need to use short data type instead of short int.
need an explanation for this answer? contact us directly to get an explanation for this answer