- 1

Why it says no output ???

when you click on try it your self button and when you choose run there is nothing shown by it and just said no output . please help me why ?? class MyClass { public static void main(String[ ] args) { String name ="David"; int age = 42; double score =15.9; char group = 'Z'; } }

13th Nov 2016, 1:58 PM
Amirmohammad Ghasemnezhad
Amirmohammad Ghasemnezhad - avatar
8 odpowiedzi
+ 6
you must use System.out.println(); like class MyClass { public static void main(String[ ] args) { String name ="David"; int age = 42; double score =15.9; char group = 'Z'; System.out.println(name); System.out.println(age); } }
13th Nov 2016, 2:13 PM
Burey
Burey - avatar
+ 3
they have many usages the println function merely print the given parameter to the terminal you can use this function on the other variables as well
13th Nov 2016, 2:28 PM
Burey
Burey - avatar
+ 3
you can make about everything with them from basic mathematical operations to complex analysis of black holes or whatever it all depends on the depth of which you research and learn :)
13th Nov 2016, 2:56 PM
Burey
Burey - avatar
+ 3
calculate the year you were born for example class MyClass { public static void main(String[ ] args) { int YEAR = 2016; int age = 26; System.out.println("You were born in:" + (YEAR-age)); } }
13th Nov 2016, 4:53 PM
Burey
Burey - avatar
+ 1
thanks
13th Nov 2016, 5:08 PM
Amirmohammad Ghasemnezhad
Amirmohammad Ghasemnezhad - avatar
0
so that's the usage of string or int code ??
13th Nov 2016, 2:15 PM
Amirmohammad Ghasemnezhad
Amirmohammad Ghasemnezhad - avatar
0
can you give me a example
13th Nov 2016, 2:45 PM
Amirmohammad Ghasemnezhad
Amirmohammad Ghasemnezhad - avatar
0
please give a simple example which you know .
13th Nov 2016, 3:22 PM
Amirmohammad Ghasemnezhad
Amirmohammad Ghasemnezhad - avatar