preview

Pros And Disadvantages Of Java

Decent Essays
Introduction Java is a programming language first released by Sun Microsystems in 1995. There is a lot of devices 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 datacenters, game consoles to scientific per computers, cell phones to the Internet, Java is everywhere! Java Advantages Java advantage can be summarize in those points 1- It is the current “hot” language 2- It is almost entirely object-oriented 3- It has a vast library of predefined objects and operations 4- It is more platform independent 5- This makes it great for Web programming Java is object-oriented An object can take advantage of being part of a class of objects and inherit…show more content…
Let’s presume the constant value is (X), and the amount of fuel that the vehicle have is (Y), we can know the distance (D) according to this equation D = Y * X Can be implemented in code as follows public double getDistance(double fuel){ double distance = fuel * 10.6382978723; return distance; } The program will return distance telling the user how far he can go on his drive. The fuel amount is by litters, and the distance in Kilometers. Java Option Panes Another useful class for accepting user input, and displaying results, is the JOptionPane class. This is located in the javax.swing library. The JOptionPane class allows you to have input boxes like this one: The first thing to do is to reference the library we want to use: import javax.swing.JOptionPane; This tells java that we want to use the JOptionPane class, located in the javax.swing library. After getting all the inputs from the user, the program will out put the result in a message box like
Get Access