首页 > 其他分享 >创建类

创建类

时间:2022-09-30 14:46:38浏览次数:48  
标签:创建 void System walk a1 public out

public  class PersonTest {
           public static void main(String[] args){
                  Person a1 = new Game Character();
                  a1.name = "momo";
                  a1.walk();
                  a1.running();
                  a1.talk("Chinese");
           
           }
}

class Game Character{
      String name;
      int age;
      boolean isFemale;

       public void walk(){
              System.out.println("walk");
       }
       public void running(){
              System.out.println("running");
       }
       public void talk(String language){
              System.out.println("talk" + language);
       }
}                

标签:创建,void,System,walk,a1,public,out
From: https://www.cnblogs.com/c1048101786/p/16744833.html

相关文章