Q. What will be the output of the following Java program?

Code:
class increment 
{
    public static void main(String args[])
    {
        double var1 = 1 + 5; 
        double var2 = var1 / 4;
        int var3 = 1 + 5;
        int var4 = var3 / 4;
        System.out.print(var2 + " " + var4);

    } 
}
  • (A) 1 1
  • (B) 0 1
  • (C) 1.5 1
  • (D) 1.5 1.0
πŸ’¬ Discuss
βœ… Correct Answer: (C) 1.5 1

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
84
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Sandhya Thakur
Publisher
πŸ“ˆ
88%
Success Rate