0
Some one help me with this code . They said there's a problem with the second line of code
package demoproject; public class myclass{ public static void main(String[] args) { // you are welcome to java System.out.println("hello to the world"); String name = ("Richard Afful"); int age = (23); double height = (153.34); System.out.println("name"); System.out.println("age"); System.out.println("height"); } }
5 ответов
0
Where is my fault coming from and how can I solve that
0
**Commented out line 1**
//package demoproject;
public class myclass{
public static void main(String[] args) {
// you are welcome to java
System.out.println("Hello to the world!");
String name = "Richard Afful"; ** () around the variable data is not necessary **
int age = 23;
double height = 153.34;
System.out.println(name); ** "name" will print name ... name without "" will print the variable data.
System.out.println(age);
System.out.println(height);
}
}
0
So how should the code look like
0
public class myclass{
public static void main(String[] args) {
System.out.println("Hello to the world!");
String name = "Richard Afful";
int age = 23;
double height = 153.34;
System.out.println(name);
System.out.println(age);
System.out.println(height);
}
}
0
thanks much