Free Essay

Differences Between C++ and Java

In:

Submitted By jazzu
Words 1720
Pages 7
Difference between C++ and JAVA:-
1. Java has no preprocessor. If you want to use classes in another library, you say Import and the name of the library. There are no preprocessors-like macros.
2. there are no pointers in the sense of C and C++. When you create an object with new, you get back a reference.
3. there are no destructors in Java. There is no “scope” of a variable per seen, to indicate when the object’s lifetime is ended-the lifetime of an object is determined instead by the garbage collection.
4. There is no GOTO statement in JAVA.
5. No INLINE methods. The java compiler might decide it’s own to inline a method, but you don’t have much control over this. You can suggest inlining in java by using FINAL keyword for a method. However , inline functions are only suggestions to the C++ compiler as well.
6. Java has method overloading that works virtually identically to C++ function overloading.
7. Java doesn’t create exe file after the execution of a program.
8.
9. > In Java, the sizes of int, long etc. are rigidly defined in terms of
10. > bits. In C++ they are platform−dependent.
11. >
12. > In Java, the JVM behaves at if it were big endian, even if internally
13. > it is actually little−endian. In C++, the endianness is platform
14. > dependent.
15. >
16. > In Java, garbage collection of unreferenced objects is automatic. In
17. > C++, you manually manage memory.
18. >
19. > In Java, references are constrained to point only to the beginnings of
20. > objects. In C++, you can do arithmetic on pointers and make pointers
21. > point anywhere in the address space.
22. >
23. > In Java you cannot overload operators. In C++, you can.
24. >
25. > In Java, by default methods are virtual (overrideable). In C++, by
26. > default, methods are non−virtual.
27. >
28. > Java object code (class files containing JVM byte codes) will run
29. > unmodified on any platform. C++ object code must be first linked to
30. > produce an executable containing platform−specific machine
31. > instructions. It will run only on one platform.
32. >
33. > Java checks all subscripts that they are in bounds and all casts for
34. > validity. C++ does not.
35. >
36. > Java requires a JVM to execute. C++ programs are usually freestanding.
37. > Java does not use a preprocessor. C++ makes extensive use of a macro
38. > preprocessor.

Constants and Variables
A quantity, which may vary during a program execution, is called a variable.
A quantity whose value cannot be changed is called Constant.
e.g. in expression c = a + b - 5;
In above expression a, b, c are variables and 5 is constant.

Rules for naming variables in JAVA
(i) A variable name is any combination of alphabets digits or underscore ( _ ). Some compilers allow variable names up to 40-characters in length.
(ii) The first character of the variable name must be an alphabet i.e. it must not be a digit.
(iii) There should not be any blank space or comma within variable name.
(iv) No special symbol other than ( _ ) underscore can be used within variable name e.g. ?,*,+,’ etc.
(v) It should not be a keyword.

Keywords:
Keywords are the words whose meaning has already been explained to the JAVA-Compiler. The keyword cannot be used as variable name because doing so will try to assign a new meaning to keyword, which is not allowed by the compiler. e.g. float, if, int, do, for, break, while, else, switch, class, private, public etc.

Tokens : Token is the smallest part of statement, it may be an operator, variable, constant, punctuation mark or keyword. E.g. the statement if ( a >5)
Above statement has 6 tokens as if , ( , a , > , 5 , )

Identifiers : Identifiers refer to the names of variables, functions, arrays, classes etc. created by the programmer. Each language has its own rules for naming identifiers. The rules for naming identifiers in C / C++ has been given above with heading “Rules naming variables in JAVA”

Writing JAVA Program:
Each JAVA program defines a class. The name of class is same as that of name of .java file in which this source program is to be stored. For core java, there must exist a public function named “main”, receiving command-line-arguments as an array of String class. This member method will be executed when java program is executed. As every java program is definition of a class, therefore, during the execution an object of this class is automatically created and executed “main” method on that object. We cannot execute a java program without class which makes it “pure-object-oriented”. In C++, it supported the object-oriented techniques, but itself C++ was not a pure-object-oriented language because C++ used the procedure “main ( )” as startup method/function, which was not a member of any class. Therefore, it was a procedural language because the program starts from a procedure, now, objects can be declared and used within that procedure but the still it a procedure that invoked the code. In JAVA, a set of statements are written in a method of class, that are executed sequentially to accomplish the task.

Following rules are applicable on all JAVA statements
(i) Blank spaces may be inserted between two words/keywords to improve the readability of the statement. However no blank spaces are allowed within variable, constant or keywords.
(ii) Writing statements in Java language is case sensitive.
(iii) Any Java-Statement always ends with a semicolon
(iv) Remarks can be written using double backslashes ( // ) on the same line
Where ever // appears, whole line after that is ignored by the compiler If we want to add multi line remarks then we use /* ---------- */ to write remarks in between them e.g. /*………………………………………………… ………………………………………………… ………………………………………………… */

Types of Statements/instructions in JAVA
Now, let us see how constants, variables and expressions are combined together to form instructions
There are basically 4-types of instructions:
1. Type Declaration Instructions
2. Input / Output Instructions
3. Arithmetic and logical instructions (Expressions)
4. Control Instructions

Data Types One of the fundamental concepts of any programming language is that of data types. Data types define the storage methods available for representing information, along with how the information is interpreted. Data types are linked tightly to the storage of variables in memory because the data type of a variable determines how the compiler interprets the contents of the memory. You already have received a little taste of data types in the discussion of literal types. To create a variable in memory, you must declare it by providing the type of the variable as well as an identifier that uniquely identifies the variable. The syntax of the Java declaration statement for variables follows: Type Identifier [, Identifier];

The declaration statement tells the compiler to set aside memory for a variable of type Type with the name Identifier. The optional bracketed Identifier indicates that you can make multiple declarations of the same type by separating them with commas. Finally, as in all Java statements, the declaration statement ends with a semicolon. Java data types can be divided into two categories: simple and composite. Simple data types are core types that are not derived from any other types. Integer, floating-point, Boolean, and character types are all simple types. Composite types, on the other hand, are based on simple types, and include strings, arrays, and both classes and interfaces in general. You’ll learn about arrays later in this chapter. Classes and interfaces are covered in Chapter 14, “Classes, Packages, and Interfaces.”
In C++, Data Types are further divided into categories :
(i) Built-in (basic) data types : int, float, char, long int etc.
(ii) use defined data types : class, interface
(iii) derived data types : array, function

Integer Data Types Integer data types are used to represent signed integer numbers. There are four integer types: byte, short, int, and long. Each of these types takes up a different amount of space in memory, as shown in Table 12.4. Table 12.4. Java integer types. * *Type *Size

byte 1 byte short 2 byte int 4 byte long 8 byte To declare variables using the integer types, use the declaration syntax mentioned previously with the desired type. The following are some examples of declaring integer variables: int i; short rocketFuel; long angle, magnitude; byte red, green, blue;

Floating-Point Data Types Floating-point data types are used to represent numbers with fractional parts. There are two floating-point types: float and double. The float type reserves storage for a 32-bit single-precision number and the double type reserves storage for a 64-bit double-precision number. Declaring floating-point variables is very similar to declaring integer variables. The following are some examples of floating-point variable declarations: float temperature; double windSpeed, barometricPressure;

*Type *Size

single 4 bytes Double 8 bytes boolean Data Type The boolean data type is used to store values with one of two states: true or false. You can think of the boolean type as a 1-bit integer value, because 1 bit can have only two possible values: 1 or 0. However, instead of using 1 and 0, you use the Java keywords true and false. true and false aren’t just conveniences in Java; they are actually the only legal Boolean values. This means that you can’t interchangeably use Booleans and integers like in C/C++. To declare a Boolean value, just use the boolean type declaration: boolean gameOver;

Character Data Type The character data type is used to store single Unicode characters. Because the Unicode character set is composed of 16-bit values, the char data type is stored as a 16-bit unsigned integer. You create variables of type char as follows: char firstInitial, lastInitial;

Remember that the char type is useful only for storing single characters. If you come from a C/C++ background, you might be tempted to try to fashion a string by creating an array of chars. In Java this isn’t necessary because the String class takes care of handling strings. This doesn’t mean that you should never create arrays of characters, it just means that you shouldn’t use a character array when you really want a string. C and C++ do not distinguish between character arrays and strings, but Java does.

Similar Documents

Premium Essay

Java vs .Net

...to be a near 50/50 split between the Java and .NET platforms. The astute student of software development must do their research and choose which platform they would like to be the most proficient in. There are different advantages to each platform which must be considered. One advantage to the .NET platform is that there are many languages, and by extension many class libraries, that are used in conjunction with each other. .NET also allows developers to produce usable results in a much shorter time frame. Advantages to becoming a Java developer include, generally, a much more intimate knowledge of the code produced and how it works. Another advantage is that with the use of the Java Virtual Machine, code can be written once and run on almost any system without having to recode it. Students must take these differences into account when deciding which platform to choose.   Introduction Object-oriented programming helps to make computer programs much more manageable through the use of reusable objects, inheritance and polymorphism. It was first developed by Dr. Alan Kay and a group of programmers at Xerox in the 1970’s. They developed a language called Smalltalk which was the first to really flesh out object-oriented ideas.(Murphy, 2008) The first wide commercial use of object orientation began with the invention of the C++ language in the early 1980’s; when Bjarn Stroustrup integrated object oriented concepts into the already established C language.(Dolya, 2003) Since...

Words: 2068 - Pages: 9

Free Essay

Java Basics

...1 Learn Java/J2EE core concepts and key areas With Java/J2EE Job Interview Companion By K.Arulkumaran & A.Sivayini Technical Reviewers Craig Malone Stuart Watson Arulazi Dhesiaseelan Lara D’Albreo Cover Design, Layout, & Editing A.Sivayini Acknowledgements A. Sivayini Mr. & Mrs. R. Kumaraswamipillai 2 Java/J2EE Job Interview Companion Copy Right 2005-2007 ISBN 978-1-4116-6824-9 The author has made every effort in the preparation of this book to ensure the accuracy of the information. However, information in this book is sold without warranty either expressed or implied. The author will not be held liable for any damages caused or alleged to be caused either directly or indirectly by this book. Please e-mail feedback & corrections (technical, grammatical and/or spelling) to java-interview@hotmail.com First Edition (220+ Q&A): Dec 2005 Second Edition (400+ Q&A): March 2007 3 Outline SECTION DESCRIPTION What this book will do for you? Motivation for this book Key Areas index SECTION 1 Interview questions and answers on: Java Fundamentals Swing Applet Performance and Memory issues Personal and Behavioral/Situational Behaving right in an interview Key Points SECTION 2 Interview questions and answers on: Enterprise Java J2EE Overview Servlet JSP JDBC / JTA JNDI / LDAP RMI EJB JMS XML SQL, Database, and O/R mapping RUP & UML Struts Web and Application servers. Best practices and performance considerations. Testing and deployment. Personal and...

Words: 23255 - Pages: 94

Premium Essay

Java

...A Comparison between Java and .Net Languages Introduction Java and .Net provide technologies that enable skilled developers to build quality enterprise applications. These technologies are rarely picked based on performance alone. There are many factors to consider when choosing Java or .Net. These considerations are often the deciding factor when choosing one or both of these platforms. Java Java is kenned as both a programming language and a development platform. It was first developed by Sun Microsystems in 1991 and subsequently relinquished in 1995. To help to make the language more accepted and accessible, Sun Microsystems developed it as an object oriented language with a syntax that is very similar to C++. (Java vs. .NET, 2007) Sun Microsystems decided to create this new platform out of a desire to be able to write programs only once that could be run on any system. (James) The Java 2 platform was launched in December 1998. This was a major amelioration of the platform, and included incipient graphics, user interface, and enterprise capabilities. This upgrade was over seven times as large as the initial Java 1.0 release and marked the maturity of the Java platform. (What is java?) Within the Java 2 platform there are 3 editions: • The Java 2 Standard Edition (J2SE) Provides the essential compiler, tools, runtimes, and APIs for writing, deploying, and running applets and applications. • The Java 2 Enterprise Edition (J2EE) Defines a standard for developing multi-tier...

Words: 2279 - Pages: 10

Premium Essay

Java

...JMaster list of Java interview questions - 115 questions By admin | July 18, 2005 115 questions total, not for the weak. Covers everything from basics to JDBC connectivity, AWT and JSP. 1. What is the difference between procedural and object-oriented programs?- a) In procedural program, programming logic follows certain procedures and the instructions are executed one after another. In OOP program, unit of program is object, which is nothing but combination of data and code. b) In procedural program, data is exposed to the whole program whereas in OOPs program, it is accessible with in the object and which in turn assures the security of the code. 2. What are Encapsulation, Inheritance and Polymorphism?- Encapsulation is the mechanism that binds together code and data it manipulates and keeps both safe from outside interference and misuse. Inheritance is the process by which one object acquires the properties of another object. Polymorphism is the feature that allows one interface to be used for general class actions. 3. What is the difference between Assignment and Initialization?- Assignment can be done as many times as desired whereas initialization can be done only once. 4. What is OOPs?- Object oriented programming organizes a program around its data, i. e. , objects and a set of well defined interfaces to that data. An object-oriented program can be characterized as data controlling 5. access to code. What are Class, Constructor...

Words: 6762 - Pages: 28

Free Essay

Nadda

...Review Guide Table of Contents OOPS ................................................................................................................................................................................................. 2 JAVA .................................................................................................................................................................................................. 3 C#....................................................................................................................................................................................................... 4 Database/SQL ................................................................................................................................................................................... 6 Web Development............................................................................................................................................................................ 7 SDLC................................................................................................................................................................................................... 9 UML ................................................................................................................................................................................................. 11 1 Review Guide OOPS Resources:  http://en.wikipedia...

Words: 2407 - Pages: 10

Premium Essay

Cis Web Gaming

...Week 1 Reading: Lecture Java and C++ Similarities Chapter 1: Introduction to Computers, Programs, and Java Sections 1.5, 1.6, 1.7, 1.8, 1.9 Chapter 2: Elementary Programming Sections 2.3, 2.7, 2.11, 2.13, 2,15, 2.16, 2.18 Chapter 3: Selections Sections 3.16, 3.17, 3.18, 3.19 Chapter 4: Loops Section 4.10 Chapter 5: Methods Sections 5.2, 5.3, 5.8, 5.9, 5.10, 5.11 Chapter 6: Single Dimensional Arrays Sections 6.1, 6.2, 6.5, 6.6 Create a Word document containing the answers to all the problems given below. 1. What is the Java source filename extension? What is the Java bytecode filename extension? Java Source filename extension is .java Java Bytecode will be stored in .class filename 2. Write a Java statement to display the string “The value is 100” to a user in a plain dialog box. import javax.swing.JOptionPane; public class ValueMessage {     public static void main (String[] args)     {       JOptionPane.showMessageDialog(null, “The value is 100”);     } } 3. What is the command you would use to compile the file Addition.java? Javac 4. What is the command you would use to execute the Addition class? Java 5. What does a Java class contain that identifies it as a Java application? A Main Method public static void main(String args[]) 6. Write a Java statement that declares a constant...

Words: 734 - Pages: 3

Premium Essay

Java

...we're continuing our Java security research series by analyzing other plug-ins, browser extensions and rich internet applications that are commonly exploited. Our previous research indicated that the current state of Java affairs isn't pretty. At that time, ninety-three percent of enterprises were vulnerable to known Java exploits. Nearly 50 percent of enterprise traffic used a Java version that was more than two years out of date. Through Websense ThreatSeeker Intelligence Cloud analysis we now discover: Only 19 percent of enterprise Windows-based computers ran the latest version of Java (7u25) between August 1-29, 2013. More than 40 percent of enterprise Java requests are from browsers still using outdated Java 6. As a result, more than 80 percent of Java requests are susceptible to two popular new Java exploits: CVE-2013-2473 and CVE-2013-2463. 83.86 percent of enterprise browsers have Java enabled. Nearly 40 percent of users are not running the most up-to-date versions of Flash. In fact, nearly 25 percent of Flash installations are more than six months old, close to 20 percent are outdated by a year and nearly 11 percent are two years old. Our in-depth analysis ran for one month, across multiple verticals and industries. We surveyed millions of real-world web requests for Java usage through our global Websense ThreatSeeker Intelligence Cloud. New Java Exploits and the Neutrino Exploit Kit New Java exploits CVE-2013-2473...

Words: 1745 - Pages: 7

Free Essay

Computer

...CONTENT Page No 1 2 3 4 5 6 7 8 9 10 Academic calendar Digital Communications Microprocessors and microcontrollers Digital Signal Processing Object Oriented Programming Through Java Managerial Economics And Financial Analysis Digital Signal Processing Lab Microprocessor & Microcontroller Lab Advanced English Communication Skills Lab Object Orient Programming Through Java Lab 2 3 48 85 129 186 217 219 222 224 ACADEMIC CALENDAR VIGNAN INSTITUTE OF TECHNOLOGY AND SCIENCE DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING DEPARTMENT ACADEMIC CALENDAR B. Tech Academic Year 2013 - 2014 - II - Semester S.No Event Date th 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. Submission of abstracts of main project by IV years Faculty orientation program Commencement of Class work Spell for UNIT – I Instructions Fresher’s day Spell for UNIT – II Instructions Alumni meet VIGNAN TARANG Spell for Unit-III Instructions st nd Assignment -1/ Unit test-1 on I & II Units Submission of results & week students list to Dept Spell for Unit-IV Instructions University I-Mid-Exam- II & IV Year rd University I-Mid-Exam- III Year Spell for UNIT – V Instructions for II &IV years rd Spell for UNIT – V Instructions for III year LAB INTERNAL-1 Commencement of Special classes for Slow learners Spell for UNIT – VI Instructions for II &IV years rd Spell for UNIT – VI Instructions for III year Submission of Mini project title along with guide for III year Spell for Unit...

Words: 28702 - Pages: 115

Premium Essay

Comparison of C, C++, and C#

...Jason Latham Comparison of C, C++, and C# IADT Seattle The C family of languages has been a cornerstone in the programming field for years. So exactly what is the C family? It includes the C, C++ and C# (pronounced sharp) languages. Now that we know what they are, what are the differences between the three? Well, that is what will be discussed here. C is a minimalistic programming language because it could be compiled in a straightforward manner by a relatively simple compiler. C offers low-level access to memory via pointers and the ability to access specific hardware addresses. C generates only a few instructions of machine languages for each of its core language elements and does not require extensive run-time support. It can be concluded that C language is suitable for many systems-programming applications that had traditionally been implemented in assembly languages (Gabb, 2012). With its inherent low-level memory access and small run-time support, using C for embedded hardware systems is ideal. Many devices such as robots, machinery, and electronic tools are programmed utilizing its ability to access specific hardware addresses. However, as C is structured oriented programming language and focuses on the procedural programming paradigm, it is relatively hard to control the large-scale program. As C language has high level and machine level mixed programming capacity, it is used in most hardware related applications. It is very suitable for writing programs in embedded...

Words: 1038 - Pages: 5

Premium Essay

Java and Java Script

...and lastly to the Internet, one thing has been a constant, different languages evolved based on a need. For these two languages, the Internet was a perfect fit, and without them the Internet would be a less dynamic and vibrant highway. As the Internet grew, more and more people found it a more viable place to do business. With that came a need for languages that were fairly easy to learn, dynamic, secure, portable, and maintainable. The industry answered that call with languages such as Java and JavaScript. This paper will perform an analysis of both Java and JavaScript. In order for the reader to gain a better understanding of these languages, the history of these languages with overviews will be presented along with a discussion of the benefits and drawbacks. The History of Java In the middle of May 1995 Java was introduced into the world, and along with Netscape it would be the new way for Internet users to access this new information superhighway. But before it got to this point, Java technology was developed almost by accident. Back in 1991, Sun Microsystems was looking into the future in anticipation of the future of computing, and they tasked a team that became know as the “Green Project”. Their main focus was to come up with a plan for the future of computing, but what they came out with was something quite unexpected. Under the guidance of James Gosling, a team was locked away in an external site to work on the project that would define Sun’s technology direction...

Words: 1329 - Pages: 6

Free Essay

It in Pakistan After 10 Years

...Java RMI and .Net Remoting Performance Comparison Willem Elbers, Frank Koopmans and Ken Madlener Radboud Universiteit Nijmegen December 2004 Abstract Java and .Net are both widely used for creating Middleware solutions. There are many interesting aspects which can be compared between Java and .Net. In this paper we examine the architecture of Java RMI and .Net Remoting and test their performance as they come ”out-of-the-box”. The performance was measured over a series of 3 different tests using .Net and Java’s high performance timers and our own modules to measure CPU utilization and Memory usage. In all our tests Java RMI had the best performance times. 1 1 Introduction The creation of software has been evolving strongly over the past few years. High level programming languages are increasingly popular amongst software developers because there is a great need for software quality and lower development times, while not compromising on performance. Also, the Internet has become increasingly popular and the need for networking applications is greater then ever. Java and .Net are both widely used for creating Middleware solutions. There are many interesting aspects which can be compared between Java and .Net, this paper focuses specifically on Middleware performance. First there will be an overview of the Java and .Net middleware implementations, Java RMI and .Net Remoting. These will be described on an abstract level which will help understanding and explaining the...

Words: 2911 - Pages: 12

Premium Essay

Essay

...STATE ENGINEERING UNIVERCITY OF ARMENIA (Politechnik) Report Theme: A history of computer programming languages Student: Davtyan Maria Professor: Ghazaryan Hasmik Group: ՄՏՏ 304 Yerevan 2014 A History of Computer Programming Languages Ever since the invention of Charles Babbage’s difference engine in 1822, computers have required a means of instructing them to perform a specific task. This means is known as a programming language. Computer languages were first composed of a series of steps to wire a particular program; these morphed into a series of steps keyed into the computer and then executed; later these languages acquired advanced features such as logical branching and object orientation. The computer languages of the last fifty years have come in two stages, the first major languages and the second major languages, which are in use today. In the beginning, Charles Babbage’s difference engine could only be made to execute tasks by changing the gears which executed the calculations. Thus, the earliest form of a computer language was physical motion. Eventually, physical motion was replaced by electrical signals when the US Government built the ENIAC in 1942. It followed many of the same principles of Babbage’s engine and hence, could only be “programmed” by presetting switches and rewiring the entire system for each new “program” or calculation. This...

Words: 2186 - Pages: 9

Premium Essay

Advantages and Disadvantages of Java V.Net

...Advantages and Disadvantages of Java v. .NET University of Phoenix CSS/422 .NET and Java There is no shortage of definitions for software architecture but in a general sense it is the blueprint for a system, its properties and the relationships among all of the elements. It specifies all of the actions to be taken by the design and implementations teams. There are various differences between .NET and Java Technology so there are certainly advantages and disadvantages to using one or the other as software architecture. The choice, however, depends on the scope of the project and the skill of the design team. Both .NET and Java have platforms that offer a good solid foundation for project design. Java Technology is the choice of many developers because of its work-saving features and ease of use. “.NET and web services are tightly integrated and it is easier to create a basic web service in .NET” (Ranck, 2002). Advantages A major advantage of .NET is that it allows for the use of multiple languages and horizontal scalability. This feature makes it an ideal choice by developers for software architecture if they want to write programs in C++, Java or Virtual Basic because it provides a unified environment in which to work. It is easily developed and supported. Unfortunately, the same cannot be said for Java which is limited to use with the Java programming language only. Another advantage of .NET is that the interface is easily...

Words: 756 - Pages: 4

Free Essay

Essay

...INSTRUCTIONS: ANSWER QUESTION ONE AND ANY OTHER TWO QUESTIONS QUESTION ONE a) Define the following terms [6 marks] (i)Browser (ii)Webpage (iii)www (iv)HTTP b) List and explain the HTML elements [8 marks] c) State three benefits and three drawbacks of creating web-based application as CGI program [6 marks] d) Outline three differences between java script language and Ub script language [6 marks] e) Define XML and describe the syntax of a well formed XLM documents[4 marks] QUESTION TWO a) Describe four major applications of java script language b) What is CGI and show its role in web development [4 marks] c) Create a simple CGI program to develop a message “welcome to perl CGI programming” on a web browser [5 marks] d) Why is Java script referred to as object based programming language? [3 marks] QUESTION THREE a) Explain the steps that take place when the client makes a request for a web page on the internet [5 marks] b) Briefly outline three factors to consider when designing a website c) Briefly explain the three basic parts of a HTML document [3 marks] d) Describe the concept of client/server paradigm [3 marks] e) Outline five challenges faced by developers when developing web-based application for the internet [5...

Words: 400 - Pages: 2

Premium Essay

Ahahhaaha

...Java Compiler - A Java compiler is a compiler for the Java programming language. The most common form of output from a Java compiler is Java class files containing platform-neutral Java bytecode. There exist also compilers emitting optimized native machine code for a particular hardware/operating system combination. Most Java-to-bytecode compilers, Jikes being a well known exception, do virtually no optimization, leaving this until run time to be done by the JRE. The Java Virtual Machine (JVM) loads the class files and either interprets the bytecode or just-in-time compiles it to machine code and then possibly optimizes it using dynamic compilation. The very first Java compiler developed by Sun Microsystems was written in C using some libraries from C++. Java Interpreter - We can run Java on most platforms provided a platform must has a Java interpreter. That is why Java applications are platform independent. Java interpreter translates the Java bytecode into the code that can be understood by the Operating System. Basically, A Java interpreter is a software that implements the Java virtual machine and runs Java applications. As the Java compiler compiles the source code into the Java bytecode, the same way the Java interpreter translates the Java bytecode into the code that can be understood by the Operating System. When a Java interpreter is installed on any platform that means it is JVM (Java virtual machine) enabled platform. It (Java Interpreter) performs all of the...

Words: 1326 - Pages: 6