满意答案
hfsgfg43
2014.09.23
采纳率:51% 等级:12
已帮助:9833人
The java language
The java language is a remarkable example of programming language evolution.Java builds on the familiar and useful features of C++ while removing its complex,dangerous,and sperfluous elements.The result is a language that is safer,simpler and easier to use.The following sections describe Java in contrast to C++.
1.Java Is Familiar and Simple
If you have ever programmmed in C++,you will find Java's appeal to be instantaneous.Since Java's syntax mirrors that of C++,you will be able to write Java programs within minutes.Your first programs will come quickly and easily,with very little programming overhead.
You will have the feeling that you have eliminated a lot of clutter from your programs--and you will have.All the cryptic header files and preprocessor statements of C and C++ are gone.All the arcane #define statements and typesefs have been taken away.You will no longer have to delve thronugh several levels of header files to correctly reference API calls.And no one will have to suffer to figure out how to use your software.
Java programs simply import the software packages they need.These packages may be in another directory,on another side of the Internet.The Java compiler and interpreter figure out what objects are referenced and supply the necessary linkage.
2.Java Is Object-Oriented
If you think C++ is an object-oriented programming language,you are in for a big surprise .After using Java to write a few programs,you'll get a better feeling for what object-oriented software is all about.I know i did.
Java deals with classes and objects,pure and simple .They aren't just more data structures that atr available to the progammer--they are the basis for the enire programming language.
In C++,you can declare a class,but you don't have to.You can declare a structure or a union instead.You can declare a whole bunch of loosely associated variables and use them with C-style functions.InJava,classes and objects are at the center of the language.Everything else revolves around them.You can't declare functions and procedures.They don't exist.You can't use structures,unions,or typedefs.They're gone,too.You either use classes and objects or you don't use Java.It's that simple.
01分享举报