zyxln

1
package ttt; 2 3 public class Testttt { 4 public static void main() { 5 Person p =new Person(); 6 p.name="lucy"; 7 p.age=12; 8 p.sex=1; 9 p.study(); 10 int a = p.addAge(2); 11 12 } 13 14 }
 1 package ttt;
 2 
 3 public class Person {
 4 
 5         public String name;
 6         public int age;
 7         public int sex;
 8 
 9         public void study() {
10             System.out.println("studing");
11         }
12         
13         public void showAge() {
14             System.out.println(age);
15         }
16         
17         public int addAge(int i) {
18             age+=i;
19             return age;
20         }
21 
22 }

 

在eclipse中运行java时没有java Application 通常是因为 定义的main方法没有写对 缺少了 ()中的内容。

改正:将Testttt的main方法的参数写完整即可。

	public static void main(String args[]) {

  

分类:

技术点:

相关文章:

  • 2021-11-16
  • 2021-12-03
  • 2021-11-15
  • 2021-12-20
  • 2021-08-17
  • 2021-12-08
  • 2021-03-31
猜你喜欢
  • 2021-10-22
  • 2021-08-17
  • 2021-11-16
  • 2021-12-08
  • 2021-12-08
相关资源
相似解决方案