You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
321/新建文本文档.txt

326 lines
7.1 KiB

12 months ago
<EFBFBD>߳<EFBFBD>
package step1;
//<2F><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>
/********** Begin **********/
public class ThreadClassOne extends Thread{
public int i=0;
public ThreadClassOne(){
super();
}
public void run(){
for(i=0;i<10;i++){
if(i%2==1)
System.out.print(i+" ");
}
}
}
/********** End **********/
package step3;
import java.util.Scanner;
public class HelloStep3 {
public static void main(String[] args) {
System.out.println("<22>Ǽ<EFBFBD><C7BC>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>ϵͳ");
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD>");
Scanner sc = new Scanner(System.in);
/******start******/
int scope = sc.nextInt();
if(scope >=90) {
System.out.print("*****<2A><><EFBFBD>dzɼ<C7B3>");
} else if(scope>=80 && scope<90) {
System.out.print("****<2A><><EFBFBD>dzɼ<C7B3>");
} else if(scope>=70 && scope<80) {
System.out.print("***<2A><><EFBFBD>dzɼ<C7B3>");
} else if(scope>=60 && scope<70) {
System.out.print("**<2A><><EFBFBD>dzɼ<C7B3>");
} else {
System.out.print("<22><><EFBFBD>dzɼ<C7B3>");
}
/******end******/
}
}
package step4;
import java.util.Scanner;
public class HelloSwitch {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·ݣ<C2B7>");
int input = sc.nextInt(); //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>жϵ<D0B6>ǰ<EFBFBD><C7B0><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD>
/*****start*****/
switch (input) {
case 1:
System.out.println(input+"<22><><EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD>");
break;
case 2:
System.out.println(input+"<22><><EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD>");
break;
case 3:
System.out.println(input+"<22><><EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD>");
break;
case 4:
System.out.println(input+"<22><><EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD>");
break;
case 5:
System.out.println(input+"<22><><EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD>");
break;
case 6:
System.out.println(input+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
break;
case 7:
System.out.println(input+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
break;
case 8:
System.out.println(input+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
break;
case 9:
System.out.println(input+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
break;
case 10:
System.out.println(input+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
break;
case 11:
System.out.println(input+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
break;
case 12:
System.out.println(input+"<22><><EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD>");
break;
}
/*****end*****/
}
}
package step3;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class Task {
public void task() throws IOException{
/********* Begin *********/
String file1 = "src/step3/input/input.txt";
FileReader fr = new FileReader(file1);
char[] cbuf = new char[8];
fr.read(cbuf);
String file2 = "src/step3/output/output.txt";
FileWriter fw = new FileWriter(file2);
fw.write(cbuf);
fr.close();
fw.flush();
fw.close();
/********* End *********/
}
}
package step4;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class Task {
public void task() throws IOException{
/********* Begin *********/
FileReader fr = new FileReader("src/step4/input/input.txt");
FileWriter fw = new FileWriter("src/step4/output/output.txt");
int len = 0;
char[] cbuf = new char[1024];
while ((len = fr.read(cbuf))!=-1)
{
fw.write(cbuf,0,len);
}
fr.close();
fw.flush();
fw.close();
FileInputStream fs = new FileInputStream("src/step4/input/input.jpg");
FileOutputStream fos = new FileOutputStream("src/step4/output/output.jpg");
int le = 0;
byte[] bt = new byte[1024];
while ((le = fs.read(bt))!=-1)
{
fos.write (bt,0,le);
}
fs.close();
fos.flush();
fos.close();
/********* End *********/
}
}
package case1;
public class TestPersonDemo {
public static void main(String[] args) {
/********* begin *********/
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD>һPerson<6F><6E><EFBFBD><EFBFBD>p
Person p = new Person();
// <20><>p<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>Ը<EFBFBD>ֵ
p.setName("<22><><EFBFBD><EFBFBD>");
p.setAge(18);
// <20><><EFBFBD><EFBFBD>Person<6F><6E><EFBFBD>е<EFBFBD>talk()<29><><EFBFBD><EFBFBD>
p.talk();
/********* end *********/
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFB6A8>Person<6F><6E>
class Person {
/********* begin *********/
private String name;
private int age;
public String getNmae(){
return name;
}
public void setName(String name){
this.name = name;
}
public int getAge(){
return age;
}
public void setAge(int age){
this.age = age;
}
public void talk(){
System.out.println("<22><><EFBFBD>ǣ<EFBFBD>"+name+"<22><><EFBFBD><EFBFBD><EFBFBD>꣺"+age+"<22><>");
}
/********* end *********/
}
package case2;
public class extendsTest {
public static void main(String args[]) {
// ʵ<><CAB5><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Cat<61><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>name<6D><65>age<67><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>voice()<29><>eat()<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD>ֺ<EFBFBD><D6BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
/********* begin *********/
Cat cat = new Cat();
cat.name = "<22><><EFBFBD><EFBFBD>è";
cat.age = "6<><36>";
cat.voice();
cat.eat();
System.out.println(cat.name+cat.age);
/********* end *********/
// ʵ<><CAB5><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Dog<6F><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>name<6D><65>age<67><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>voice()<29><>eat()<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD>ֺ<EFBFBD><D6BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
/********* begin *********/
Dog dog = new Dog();
dog.name = "<22><><EFBFBD>ڹ<EFBFBD>";
dog.age = "8<><38>";
dog.voice();
dog.eat();
System.out.println(dog.name+dog.age);
/********* end *********/
}
}
class Animal {
/********* begin *********/
String name;
String age;
/********* end *********/
}
class Cat extends Animal {
// <20><><EFBFBD><EFBFBD>Cat<61><74><EFBFBD><EFBFBD>voice()<29><>eat()<29><><EFBFBD><EFBFBD>
/********* begin *********/
public void voice(){
System.out.println(name+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
public void eat(){
System.out.println(name+"<22><><EFBFBD><EFBFBD>");
}
/********* end *********/
}
class Dog extends Animal {
// <20><><EFBFBD><EFBFBD>Dog<6F><67><EFBFBD><EFBFBD>voice()<29><>eat()<29><><EFBFBD><EFBFBD>
/********* begin *********/
public void voice(){
System.out.println(name+"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
public void eat(){
System.out.println(name+"<22>Թ<EFBFBD>ͷ");
}
/********* end *********/
}
package case7;
public class interfaceTest {
public static void main(String[] args) {
// ʵ<><CAB5><EFBFBD><EFBFBD>һStudent<6E>Ķ<EFBFBD><C4B6><EFBFBD>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>talk()<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1>Ϣ
/********* begin *********/
Student s = new Student();
s.talk();
/********* end *********/
}
}
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Person<6F>ӿڣ<D3BF><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>name<6D><65>age<67><65>occupation<6F><6E><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>󷽷<EFBFBD>talk()
interface Person {
/********* begin *********/
String name = "<22><><EFBFBD><EFBFBD>";
int age = 18;
String occupation = "ѧ<><D1A7>";
public abstract void talk();
/********* end *********/
}
// Student<6E><74><EFBFBD>̳<EFBFBD><CCB3><EFBFBD>Person<6F><6E> <20><>дtalk()<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ְҵ<D6B0><D2B5>Ϣ
class Student implements Person {
/********* begin *********/
public void talk() {
System.out.println("ѧ<><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"+name+"<22><><EFBFBD><EFBFBD><EFBFBD>䣺"+age+"<22><>ְҵ<D6B0><D2B5>"+occupation+"<22><>");
}
/********* end *********/
}