Introduction to Java ……

2

Java

Java is an object-oriented programming language and computing platform first released by Sun Micro systems in 1995 with a built-in application programming interface (API) that can handle graphics and user interfaces and that can be used to create applications or applets. Because of its rich set of API’s, similar to Macintosh and Windows, and its platform independence, Java can also be thought of as a platform in itself. Java also has standard libraries for doing mathematics.

There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to data centers, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!

Much of the syntax of Java is the same as C and C++. But there are some differences from C and C++ exist in Java. Like Java does not have an explicit pointer type. Strings in C and C++ are arrays of characters, terminated by a null character (‘’) where strings in Java are objects, and all methods that operate on strings can treat the string as a complete entity. All memory management in Java is automatic; memory is allocated automatically when an object is created, and a run-time garbage collector (the “gc”) frees that memory when the object is no longer in use. C’s malloc() and free() functions do not exist in Java.

Although the if, while, for, and do-while statements in Java are syntactically the same as they are in C and C++, there is one significant difference. The test expression for each control flow construct must return an actual boolean value (true or false). In C and C++, the expression can return an integer. Java does not have a preprocessor, and as such, does not have #defines or macros. Constants can be created by using the final modifier when declaring class and instance variables. Java does not have template classes as in C++.Java does not include C’s const keyword or the ability to pass by const reference explicitly. Java classes are singly inherited, with some multiple-inheritance features provided through interfaces. All functions must be methods. There are no functions that are not tied to classes. The goto keyword does not exist in Java (it’s a reserved word, but currently unimplemented). You can, however, use labeled breaks and continues to break out of and continue executing complex switch or loop constructs.

Share.

About Author

Tanjiba

2 Comments

Leave A Reply

Powered by themekiller.com