• java构造


    import java.util.Scanner;


    public class hey {

     /**
      * @param args
      */
         static int a,b;
         private static int add(int a,int b)
        {
         return a+b;
        }
         private static double add(double a,double b){
          return a+b;
         }
         private static String add(String a,String b)
         {
          return a+b;
         }
     public static void main(String[] args) {
      // TODO Auto-generated method stub
      Scanner cin=new Scanner (System.in);
      String a,b;
      int m,n;
      while(true)
      {
       a=cin.next();
       b=cin.next();
       System.out.println(add(a,b));
       m=cin.nextInt();
       n=cin.nextInt();
       System.out.println(add(m,n));
      }
      
     }

    }


    public class Student {
       private String name;
       private int age;
       private String Address;
       private String tel;
      
       public Student(String name,int age,String Address,String tel)
       {
        this.name=name;
        this.Address=Address;
        this.age=age;
        this.tel=tel;
       }
    public String getName() {
     return name;
    }
    public void setName(String name) {
     this.name = name;
    }
    public int getAge() {
     return age;
    }
    public void setAge(int age) {
     this.age = age;
    }
    public String getAddress() {
     return Address;
    }
    public void setAddress(String address) {
     Address = address;
    }
    public String getTel() {
     return tel;
    }
    public void setTel(String tel) {
     this.tel = tel;
    }
      
    }


    public class Test {

     /**
      * @param args
      */
     public static void main(String[] args) {
      // TODO Auto-generated method stub
            //Student s1=new Student();
            Student s2=new Student("Hello",13,"adada","123456789");
            System.out.println("Name="+s2.getName()+" Age="+s2.getAge()+" Address="+s2.getAddress()+" Tel="+s2.getTel());
     }

    }

  • 相关阅读:
    压缩感知理论模型
    欢迎使用CSDN-markdown编辑器
    CEF3 概览及一般使用方法
    如何利用CEF3创建一个简单的应用程序 (Windows Platform)
    递归(浅解)
    day22 ftp传输作业未完成
    day21(套接字初应用)
    Multiprocess.Process(源码)
    day20 网络编程(初识)
    day19(异常补遗)
  • 原文地址:https://www.cnblogs.com/xiaziteng/p/4013949.html
Copyright © 2020-2023  润新知