+ 1
Explain its output nd working
This is from the challenge of sololearn Although I answered it correctly but not quite satisfied with it's logic so expalin me plz https://code.sololearn.com/ckOX70Zr6JmR/?ref=app
5 Respostas
+ 9
https://code.sololearn.com/W2LnAYam75y4/?ref=app
+ 3
The static variable x belongs to the class this is why you can use it in your program without having to create an object to access it, u just use the class name.
int x = 2; // this is not used
int y =1;
Program.x ⬅️ =3
Program.x+y ⬅️ =4
+ 3
~ swim ~ I know but it triggers me 😁
+ 2
Ayush Pandey no probs.
Also this in your code..
System.out.print(Program .x+y);
//There shouldn't be a gap between the class and its static variable, it should look like this all together 👍
Program.x+y