zoukankan      html  css  js  c++  java
  • eclipse中运行java程序


    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[]) {
    

      

  • 相关阅读:
    Scala-函数
    Scala--循环
    scala(一)
    拦截器filter
    Ajax实现分页二
    并发1
    泛型
    协议protocol
    结构体structure
    类的继承
  • 原文地址:https://www.cnblogs.com/zyxln/p/11732518.html
Copyright © 2011-2022 走看看