Error:(7, 22) java: 期望 ')' 在执行我的代码时

huangapple go评论97阅读模式
英文:

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

huangapple
  • 本文由 发表于 2020年7月24日 17:35:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/63070879.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定