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'; } }

9th Sep 2016, 5:09 AM
Remon
Remon - avatar
9 Answers
+ 6
you are not giving any code to output System.out.println(name ); //prints David System.out.println(age ); //prints 42
9th Sep 2016, 11:04 AM
Nitesh Kumar Niranjan
Nitesh Kumar Niranjan - avatar
+ 2
System.out.println(name); Using this you can print your String... and the output will be.. David
9th Sep 2016, 5:33 AM
Shafiq Bangulzai
Shafiq Bangulzai - avatar
+ 1
you just have initialized the variables,To display them you must use System.out.print/printing();
9th Sep 2016, 11:46 PM
Ankur Sharma
Ankur Sharma - avatar
+ 1
ur are not at all using statements to print.Use system.out.println
11th Sep 2016, 5:19 PM
Dheeraj Reddy
Dheeraj Reddy - avatar
+ 1
you have to make it print by the following code System.output.println(name) and and age etc.. enjoy java
22nd Sep 2016, 12:23 AM
Akhil Mittal
Akhil Mittal - avatar
0
so what's the usage of string in that code ??
13th Nov 2016, 2:06 PM
Amirmohammad Ghasemnezhad
Amirmohammad Ghasemnezhad - avatar
0
thnx
13th Nov 2016, 2:32 PM
Remon
Remon - avatar
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
4th Dec 2016, 2:50 PM
Noman Shakoor
Noman Shakoor - avatar
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
25th Jan 2017, 2:25 PM
Pansare Shyam