求一篇10000字符的关于java方面的英文文章。
有人能推荐类似的文章吗?或者类似的英文网站都可以?如果有翻译就更好了,谢谢!
最新问答
- 钉子生锈了
Applet举例。
源程序如下:
import java.awt.Graphics; //声明applet使用了java.awt包中的Graphics类
import java.applet.Applet; //声明applet使用了java.applet包中的Applet类
public class.MyApplet extends Applet{ //声明一个名为MyApplet的公共类,它继承了Applet类
public String s; //声明一个字符串
public void init( ){ //Applet的初始化方法
s = new String("Hello World !"); //创建一个字符串
}
public void paint(Graphics g){
g.drawString(s,60,40);
}
}
一、解释:
1、Graphics类使得Applet可以绘制直线、矩形、椭圆形、字符串等。此程序中,绘制了“Hello World!”字符串
2、方法init( )实现了字符串的创建
3、paint( )中,g为Graphics类的对象。它调用了Graphics的drawString方法绘制字符串。
4、drawString方法中的第一个参数是要绘制的字符串s,后面两个参数(60,40)说明了字符串左下角所在的平面坐标,60为横坐标,40为纵坐标。
5、Java的坐标系原点在左上角,纵轴正方向指向下方。坐标单位是像素。
二、编译源程序为Class文件
javac MyApplet.java
三、Applet中没有main( )方法作为Java解释器的入口,因此必须编写HTML文件,把Applet嵌入HTML文件中,然后用appletviewer来运行,或在支持Java的浏览器上运行HTML文件。HTML文件内容如下:My Applet
Java provides all he luxuries of object-oriented programming:class
hierarchy,inheritance,encapsulation,and polymorphism--in a context that is truly useful and
efficient.
The main reason for developing object-oriented software,besides clarity and simplicity,is
the desperate hope that somehow the objects you develop will be reused.Java not only
encourages software reused.Java not only encourages software reuse,it demands it.To write
any sort of Java program,no matter how simple,you must build on the classes and methods of
the Java API.
Once you have begun developing software in Java,you have two choices:
● Build on the classes you have developed,thereby reusing them.
● Rewrite your software from scratch,copying and tailoring useful parts of existing
software.
With Java,the temptation to start from scratch is no longer appealing.Java's object-oriented
structure forces you to decelop more useful,more tailorable, and much simpler software the
first time around.
3.Java Is Safer and More Reliable
Java is safer to use than C++ because it keeps you from doing the things that you do
badly,while making it easier to do the things that you do well.
Java won't automatically convert data types.You have to explicitly convert from one class
another.C++,under the most undesirable conditions,will automatically convert one type to
another.It has all the flexibility of assembly code.Java doesn''t assume that you know what
you are doing.It makes sure that you do.
C++ pointers don'exist in Java.You can no longer access objects indirectly or by chance.You
don't need to.You declare objects and reference those objects directly.Complex pointer
arithmetic is avoided.If you need an indexed set of objects,you can use an array of
objects.The concept of "the address of an object" is eliminated from the programming errors
that go another assembly language dinosaur is laid to rest.As a result,it becomes much
easier to do things correctly on Java.
Java's reliability extends beyond the language level to the compiler and the runtime
system.Compile-time checks identify many programming errors that go undetected in other
progamming languages.These checks go beyond syntactic checking to ensure that statements are
semantically correct.
Runtime checks are also more extendsive and effective.Remember your teacher or mom telling
you to "Check your work twice to make sure it's right?"The Java linker understands class
types and performs compiler-level type checking,adding redundancy to reliability.It also
performs bounds checking and eliminates indirect object access,even under error conditions.
译文为:
JA了面向对象编程最有价值的一切:类的分级结构、继承、封装 和多态(动态绑定)——在真正意义上既可用又高效的(一切)。
开发面向对象软件的主要原因,除简明性之外,是基于一种极端希望,那就是你开发出的对象将会被重用。
JA不仅鼓励软件复用,更需要软件复用。编写任何JA软件,无论多简单,必须基于JA API的类和方法。
一旦你开始用JA开发程序,你有两个选择:
● 基于你已开发的类,即复用它们。
● 基于对已有软件可用部分的挖补、复制、修改,重写你的软件。
对于JA,从挖补开始已不再吸引人。JA的面向对象结构使你不得不从一开始就开发更好用,更易于修改而且更简单的软件。
3.JA更安全且更可靠
JA比C++使用起来更安全,因为它使你远离那些你容易弄糟的部分,同时使你擅长的部分变得更为容易。
JA不会自动转换类型,你必须显式的将一个类型转换为另一个。C++在最不愿意看到的情况下,会自动将一个类型转换为另一个。它拥有汇编语言代的所有灵活性。JA不会假设你知道你在做什么。它会确保你知道。
C++指针在JA里不存在。你无法间接地或是随机地访问对象。(因为)你无需这样做。你声明对象并且直接访问它们,避免了复杂的指针运算。
如果你需要一些编号的对象,你可以使用一个对象数组。“一个对象的地址”这一概念,就像另外一只“汇编语言恐龙”(注:恐龙代表过时但顽固的东西)一样,从编程错误中消失。
所以,在JA里更容易把事情做对。
JA的可靠性从语言级别一直延伸到编译器和运行系统级别。
编译阶段可以检查出许多在别的语言(编译)中无法检查出的错误。这些检查不仅可以针对语法甚至可以保证语句在语义上的正确性。
运行中的检查也更高效且更具扩展性。想想你的和母亲总对你说:“检查你的作业两次来保证你做对了。” JA连接器理解类的类型并且进行编译器级的类型检查,增加了可靠性的冗余(检查)。而且它还会进行边界检查,甚至在出错的情况下,也会消除 间接对象访问。浏览 297赞 131时间 2024-04-05
相关问答
-
求一篇10000字符的关于java方面的英文文章。
-
求一篇10000字以上的英文文献是关于物流方面的。
-
求:一篇关于物流与供应链方面的论文,8000—10000字
-
求有关于油气储运方面的文章英文版的4万字符
-
关于FPGA的英文文献,10000字符以上,急用!!!!
-
求一篇关于激光方面的3000字左右的英文文章
-
求一篇3000字左右的关于融资方面的英文文章
-
急求关于gis的英文文献,不少于10000字符,带中文翻译的
-
求一篇java方面的论文,4000到5000字
-
一篇关于生物方面的英文文章(200字左右)
-
急求一篇关于影视动画方面的英文文章。
-
急求建筑或城市规划方面的中英文对照文!10000字符2000字的,谢谢!!!!!
-
求一篇大约五千字左右的关于JAVA的英文文章以及翻译
-
关于金融方面的毕业论文10000字
-
求一篇关于高速铁路论文,10000字
-
求一篇关于建筑方面的英文文献
-
求一篇4000字左右机械方面的英文文章
-
有把关于JAVA四万英文字符翻译成中文的么。
-
求一篇 信息安全工程 方面的论文,字数5000-10000
-
求单片机英文文献,要求字符数10000以上!
求一篇10000字符的关于java方面的英文文章。
有人能推荐类似的文章吗?或者类似的英文网站都可以?如果有翻译就更好了,谢谢!