---恢復內容開始---java
package iop; import java.util.Scanner; public class person { private String name; private String sex; private int idnumber; private int age; public static void main(String[]args) { String name; String sex ; double age; double idnumber; // person s1=new person(); s1.name="李四"; s1.sex="female"; s1.age=18; s1.idnumber=123456734; person s2=new person(); s2.name="張三"; s2.sex="male"; s2.age=18; s2.idnumber=431010101; System.out.println("名字"+s1.name+"性別"+s1.sex+"年齡"+s1.age+"身份證號碼"+s1.idnumber); System.out.println("名字"+s2.name+"性別"+s2.sex+"年齡"+s2.age+"身份證號碼"+s2.idnumber); } }
package gvfg; import java.util.*; public class Phone1 { public Phone1() { Scanner q=new Scanner(System.in); String q1=q.nextLine(); System.out.println("手機品牌:"+q1); Scanner w=new Scanner(System.in); String w1=w.nextLine(); System.out.println("手機型號:"+w1); } public static void main(String[] args) { new Phone1(); } }
package gvfg; public class PhoneTest { private String label1; private String type1; public static void main(String[] args) { //String label1; PhoneTest q1=new PhoneTest() ; q1.label1="華爲"; q1.type1="榮耀3c"; PhoneTest q2=new PhoneTest(); q2.label1="小米"; q2.type1="note"; PhoneTest q3=new PhoneTest(); q3.label1="聯想"; q3.type1="A3600D"; System.out.println("手機品牌: "+q1.label1+" 手機型號: "+q1.type1); System.out.println("手機品牌: "+q2.label1+" 手機型號:"+q2.type1); System.out.println("手機品牌: "+q3.label1+" 手機型號:"+q3.type1); } }
package asd; import java.util.*; public class Book { public static void main(String[] args) { System.out.println("請輸入書名:"); Scanner q=new Scanner(System.in); String q1=q.nextLine(); System.out.println("書名:"+q1); System.out.println("請輸入書號:"); Scanner w=new Scanner(System.in); int w1=w.nextInt(); System.out.println("書號:"+w1); System.out.println("請輸入主編姓名:"); Scanner e=new Scanner(System.in); String e1=e.nextLine(); System.out.println("主編:"+e1); System.out.println("請輸入出版社:"); Scanner r=new Scanner(System.in); String r1=r.nextLine(); System.out.println("出版社:"+r1); System.out.println("請輸入出版時間:"); Scanner t=new Scanner(System.in); String t1=t.nextLine(); System.out.println("出版時間:"+t1); System.out.println("請輸入頁數:"); Scanner y=new Scanner(System.in); int y1=y.nextInt(); System.out.println("頁數"+y1); System.out.println("請輸入價格:"); Scanner u=new Scanner(System.in); int u1=u.nextInt(); System.out.println("價格"+u1); } }
package gvfg; public class BookTest { private String bookname; private int booknumber; private String auther; private String publisher; private int time; private int page; private int price; public static void main(String[] args) { BookTest q1=new BookTest(); q1.bookname="鬥破蒼穹"; q1.booknumber=213214343; q1.auther="天蠶土豆"; q1.publisher="起點中文網"; q1.time=2007; q1.page=500; q1.price=50; BookTest q2=new BookTest(); q2.bookname="斗羅大陸"; q2.booknumber=21332334; q2.auther="唐家三少"; q2.publisher="起點中文網"; q2.time=2009; q2.page=500; q2.price=50; System.out.println("書名: "+q1.bookname+"出版社:"+q1.publisher+" 書號: "+q1.booknumber+" 做者: "+q1.auther+" 出版時間 :"+q1.time+" 頁數 :"+q1.page+" 價格: "+q1.price); System.out.println("書名: "+q2.bookname+"出版社:"+q2.publisher+" 書號 :"+q2.booknumber+" 做者 :"+q2.auther+" 出版時間 :"+q2.time+" 頁數: "+q2.page+" 價格: "+q2.price); } }
package asd; public class Cylinder { public final static float PI= 3.14f; public static void main(String[] args) { int r=5,h=6; float area; float bulk; area=r*r*PI; bulk=area*h; System.out.println("底面積爲:"+area+" "+"體積爲"+bulk); } }
package asd; import java.util.*; public class CylinderTest { public final static float PI= 3.14f; public static void main(String[] args) { System.out.println("請輸入半徑和高!"); float area;float bulk; Scanner q=new Scanner(System.in); int q1=q.nextInt(); Scanner w=new Scanner(System.in); int w1=w.nextInt(); area=q1*q1*PI; bulk=area*w1; System.out.println("面積爲"+area); System.out.println("體積爲"+bulk); } }
---恢復內容結束---spa