Menu
Question Index
...

What are the correct ways to initialize - x, y and z to 100.

1.    
    int x = 100;
    int y = 100;
    int z = 100;

2.    
    int x = 100, y = 100, z = 100;

3.    
    int x = y = z = 100;

4.    
    int x, y, z = 100;
    x = y = z;

5.    
    int x, y, z;
    x = y = z = 100;


1 & 2
1, 2, 4 & 5
1, 2 & 5
All of them are correct

Doubts

Problems

Topic: Assignment Operator In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App