Java Programmin
Programming and Technical
Programming
what is the output of the following program..
class demo
{
public static void main( string arg[])
{
int i=10;
if(i==10)
{
System.out.print(i);
int i=20;
}
System.out.print(i);
}
}
Read Solution (Total 4)
-
- since i=10 i.e. if condition is true thus 10 get display then after since i has again initialised but in if body, thus after bracket again 10 get display not 20.
- 10 years agoHelpfull: Yes(2) No(0)
- Compile time Error : variable a already exits
- 10 years agoHelpfull: Yes(1) No(0)
- first it print 10
after it print 10 because i=20 is valid only for if loop - 9 years agoHelpfull: Yes(1) No(0)
- 10 20
first it will print 10 after that 20 - 10 years agoHelpfull: Yes(0) No(1)
Java Programmin Other Question