编译型语言的程序执行效率高

编译型语言写的程序执行之前,需要一个专门的编译过程,把程序编译成为机器语言的文件,比如exe文件,以后要运行的话就不用重新翻译了,直接使用编译的结果就行了(exe文件),因为翻译只做了一次,运行时不需要翻译,所以编译型语言的程序执行效率高。

 1 package Com.Table;
 2 
 3 
 4 class Penson
 5 {
 6     protected String name;
 7     protected String addr;
 8     protected String sex;
 9     protected int age;
10  
11     public String getName() {
12         return name;
13     }
14  
15     public void setName(String name) {
16         this.name = name;
17     }
18  
19     public String getAddr() {
20         return addr;
21     }
22  
23     public void setAddr(String addr) {
24         this.addr = addr;
25     }
26  
27     public String getSex() {
28         return sex;
29     }
30  
31     public void setSex(String sex) {
32         this.sex = sex;
33     }
34  
35     public int getAge() {
36         return age;
37     }
38  
39     public void setAge(int age) {
40         this.age = age;
41     }
42  
43     void ShowItems()
44     {
45         System.out.println("姓名:" + getName()
46                 + " 地址:" + getAddr()
47                 + " 性别:" + getSex()
48                 + " 年龄:" + getAge());
49     }
50 }
51  
52 class Student extends Penson
53 {
54     int mathScore;
55     int englishScore;
56  
57     public Student(String name, String addr, String sex, int age, int mathScore, int englishScore) {
58         this.mathScore = mathScore;
59         this.englishScore = englishScore;
60         this.name = name;
61         this.addr = addr;
62         this.sex = sex;
63         this.age = age;
64     }
65  
66     void ShowItems()
67     {
68         System.out.println("姓名:" + getName()
69                 + " 地址:" + getAddr()
70                 + " 性别:" + getSex()
71                 + " 年龄:" + getAge()
72                 + " 数学成绩:" + mathScore
73                 + " 英语成绩:" + englishScore);
74     }
75 }
76 public class FourteenTable {
77     public static void main(String []args)
78     {
79         Student stu = new Student("borter", "Beijing", "boy", 22, 80, 90);
80         stu.ShowItems();
81     }
82 }
83  

猜你喜欢

转载自www.cnblogs.com/borter/p/9384791.html