- 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'; } }
8 Réponses
+ 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);
}
}
+ 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
+ 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 :)
+ 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));
}
}
+ 1
thanks
0
so that's the usage of string or int code ??
0
can you give me a example
0
please give a simple example which you know .