英文:
Error:(7, 22) java: ')' expected when executing my code
问题
我收到了以下错误:
> 在执行我的代码时出现错误:
public class Main {
public static void main(String[] args) {
// write your code here
myName( mName:"Gowtham");
}
public static void myName(String mName) {
System.out.println(mName);
}
}
这是我想要执行的代码,但它指出有错误,是通过一些在线课程学习的。
英文:
I receive the following error:
> Error:(7, 22) java: ')' expected when executing my code:
public class Main {
public static void main(String[] args) {
// write your code here
myName( mName:"Gowtham");
}
public static void myName(String mName) {
System.out.println(mName);
}
}
This is the code I wanted to execute but it tells it has errors, learning it through some online courses.
答案1
得分: 1
错误在这里:
myName( mName:"Gowtham");
请按照以下方式编写:
public class Main {
public static void main(String[] args) {
// write your code here
myName("Gowtham");
}
public static void myName(String mName) {
System.out.println(mName);
}
}
英文:
The error is here
myName( mName:"Gowtham");
Just write it as following:
public class Main {
public static void main(String[] args) {
// write your code here
myName("Gowtham");
}
public static void myName(String mName) {
System.out.println(mName);
}
}
专注分享java语言的经验与见解,让所有开发者获益!
评论