上一页 1 ··· 6 7 8 9 10 11 12 13 下一页
摘要: View Code 1 class Math{ 2 public int div(int i,int j) throws Exception{ 3 int t=i/j; 4 return t; 5 } 6 } 7 public class ThrowsDemo { 8 public static void main(String args[]) throws Exception{ 9 Math m=new Math();10 System.out.println("出发操作:"+m.div(10,2));... 阅读全文
posted @ 2012-03-11 19:18 谈笑风生膜法师 阅读(262) 评论(0) 推荐(0)
摘要: 1 public class ObjectDemo { 2 public static void main(String[] args) { 3 String str1="30"; 4 String str2="30.3"; 5 int x=Integer.parseInt(str1); 6 float f=Float.parseFloat(str2); 7 System.out.println("整数乘方"+x+"*"+x+"="+(x*x)); 8 System.out.println... 阅读全文
posted @ 2012-03-07 21:25 谈笑风生膜法师 阅读(347) 评论(0) 推荐(0)
摘要: 1 class Person{ 2 private String name; 3 private int age; 4 public Person(String name,int age){ 5 this.name=name; 6 this.age=age; 7 } 8 public boolean equals(Object obj){ 9 if(this==obj)//地址相等?10 return true;11 if(!(obj instanceof Pers... 阅读全文
posted @ 2012-03-07 21:08 谈笑风生膜法师 阅读(277) 评论(0) 推荐(0)
摘要: 1 import java.util.Scanner; 2 3 interface Pet{ 4 public int getAge(); 5 public String getColor(); 6 public String getName(); 7 } 8 9 class Cat implements Pet{ 10 private String name; 11 private String color; 12 private int age; 13 public Cat(String name,String... 阅读全文
posted @ 2012-03-07 20:51 谈笑风生膜法师 阅读(456) 评论(0) 推荐(0)
摘要: View Code 1 interface USB{ 2 public void start(); 3 public void stop(); 4 } 5 class Computer{ 6 public static void plugin(USB usb){ 7 usb.start(); 8 System.out.println("=========USB device is working======"); 9 usb.stop();10 }11 };12 class Flash implements US... 阅读全文
posted @ 2012-03-06 20:55 谈笑风生膜法师 阅读(344) 评论(0) 推荐(0)
摘要: View Code 1 class A{ 2 public void fun1(){ 3 System.out.println("fun1-----"); 4 } 5 public void fun2(){ 6 this.fun1(); 7 } 8 }; 9 class B extends A{10 public void fun1(){11 System.out.println("fun1-----覆写");12 }13 public void fun3(){14 Sys... 阅读全文
posted @ 2012-03-06 20:19 谈笑风生膜法师 阅读(481) 评论(0) 推荐(0)
摘要: View Code 1 class A{ 2 public void fun1(){ 3 System.out.println("fun1-----"); 4 } 5 public void fun2(){ 6 this.fun1(); 7 } 8 }; 9 class B extends A{10 public void fun1(){11 System.out.println("fun1-----覆写");12 }13 public void fun2(){14 Sys... 阅读全文
posted @ 2012-03-06 19:42 谈笑风生膜法师 阅读(268) 评论(0) 推荐(0)
摘要: View Code 1 interface A{ 2 public String AUTHER="Mihchael"; 3 public void printA(); 4 } 5 interface B{ 6 public void printB(); 7 } 8 interface C extends A,B{ 9 public void printC();10 }11 class X implements C{12 public void printA(){13 System.out.println("A....");14 ... 阅读全文
posted @ 2012-03-05 21:00 谈笑风生膜法师 阅读(171) 评论(0) 推荐(0)
摘要: View Code 1 interface A{ 2 public String AUTHER="Mihchael"; 3 public void print(); 4 public String getInfo(); 5 } 6 abstract class B{ 7 public abstract void say(); 8 } 9 class X extends B implements A{10 public void say(){11 System.out.println("Hello,World!!");12 }13... 阅读全文
posted @ 2012-03-05 20:51 谈笑风生膜法师 阅读(141) 评论(0) 推荐(0)
摘要: View Code interface A{ public String AUTHER="Mihchael"; public void print(); public String getInfo();}interface B{ public void say();}class X implements A,B{ public void say(){ System.out.println("Hello,World!!"); } public void print(){ System.out.println("作者:"+AUT... 阅读全文
posted @ 2012-03-05 20:46 谈笑风生膜法师 阅读(133) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 下一页