0
why this code doesn't print any output?
class MyClass { public static void main(String[ ] args) { String name ="David"; int age = 42; double score =15.9; char group = 'Z'; } }
9 Respostas
+ 6
you are not giving any code to output
System.out.println(name ); //prints David
System.out.println(age ); //prints 42
+ 2
System.out.println(name);
Using this you can print your String...
and the output will be..
David
+ 1
you just have initialized the variables,To display them you must use System.out.print/printing();
+ 1
ur are not at all using statements to print.Use system.out.println
+ 1
you have to make it print by the following code
System.output.println(name)
and and age etc..
enjoy java
0
so what's the usage of string in that code ??
0
thnx
0
String is used to store the name or alphabet. for example
String y = "Dav";
String x = "Developer";
System.out.println(y); // output: Dav
System.out.println(x); // output: Developer
0
yes that's true this code doesn't display any output Bcz there is no any code is written for output object like System.output.print