zoukankan      html  css  js  c++  java
  • 解释性语言每执行一次就要翻译一次,效率比较低

    解释性语言编写的程序不进行预先编译,以文本方式存储程序代码。在发布程序时,看起来省了道编译工序。

    但是,在运行程序的时候,解释性语言必须先解释再运行。

    比如解释性Basic语言,其专用的解释器在执行Basic程序时,会逐条读取解释每个语句,这个其实就是一个编译过程,然后再执行。

    一般来说,现有的解释性语言都是采用的逐行解释一句,执行一句这样的方式来构建的。这样解释性语言每执行一次就要翻译一次,效率比较低。

     1 package Com.Table;
     2 
     3 class Account
     4 {
     5     String name;
     6     double balance;
     7     public Account(String name, double balance)
     8     {
     9         this.name = name;
    10         this.balance = balance;
    11     }
    12  
    13     void withdrawal(double amount) throws InsufficientFundException
    14     {
    15         if (amount > this.balance) {
    16             throw new InsufficientFundException();
    17         }
    18         else
    19         {
    20             this.balance = this.balance - amount;
    21             System.out.println(this.name+"取款成功!
    余额:" + this.balance);
    22         }
    23     }
    24 }
    25 
    26  
    27 public class EighteenTable {
    28     public static void main(String []args)
    29     {
    30         try {
    31             Account ac = new Account("borter", 50);
    32             ac.withdrawal(40);
    33             ac.withdrawal(40);
    34         }
    35         catch (InsufficientFundException e)
    36         {
    37             System.out.print("余额不足!");
    38         }
    39     }
    40 }
    41 
    42 class InsufficientFundException extends Exception
    43 {
    44  
    45 }
  • 相关阅读:
    halcon中variation_model_single实例注释.
    vc 实现打印功能
    用VisualC++建立SOAP客户端应用(一)
    第六章
    OpenCV】透视变换 Perspective Transformation(续)
    第六章
    OpenCV仿射变换+投射变换+单应性矩阵
    【最新图文教程】WinCE5.0中文模拟器SDK(VS2008)的配置
    Visual Studio 2008 使用 WinCE 5.0 Emulator
    Win32 CMD批处理命令
  • 原文地址:https://www.cnblogs.com/borter/p/9385128.html
Copyright © 2011-2022 走看看