Explore BrainMass


Java is a general-purpose, object-orientated computer programming language that was designed specifically to avoid implementation dependencies so as to allow a 'write once, run anywhere' style of programming for developers. To do this, Java programs compile into bytecode that can be run on any java cirtual machine without requiring recompiling to be compatible with a new platform or computer architecture. This portability, along with many other useful features, makes it one of the most popular programming languages today.

The Java language project was initiated in June 1991 by James Gosling, Mike Sheridan and Patrick Naughton1 but the first public implementation release from Sun Microsystems didn't come until 19952. Java promised no cost run times on popular platforms and web browsers. Since then, Sun Microsystems has been acquired by Oracle, who have maintain Java and its subsequent releases.

There were five primary goals in the creation of the Java language3. The developers wanted Java to be:

  1. “simple, object orientated and familiar”
  2. “robust and secure”
  3. "architecture-neutral and portable”
  4. execable with “high performance”
  5. interpreted, threaded and dynamic”

In order to meet the first requirement which included 'familiarity', the syntax of Java was derived from C++ which is itself more or less a superset of C, a procedural language. However, unlike C++, which combines the syntax for its structured, generic, procedural language base with some new syntax in order to be enhanced for object-orientated programming, Java was built almost exclusively as an object-oriented language. In Java, you cannot even do a 'Hello World' program without a class. Aside from primitve data types (the int type, etc., which are not treated as objects for performance reasons), all code is written inside a class and everything is an object



1. Byous, Jon (ca. 1998). "Java technology: The early years". Sun Developer Network. Sun Microsystems. Archived from The original on April 20, 2005. Retrieved 2013-07-18.

2. "The History of Java Technology". Retrieved July 18, 2013.

3. "The Java Language Environment". 1.2 Design Goals of the Java™ Programming Language. Oracle. 1999-01-01. Retrieved 2013-07-18.

© BrainMass Inc. brainmass.com May 22, 2019, 5:37 pm ad1c9bdddf

Nested-if Statement (Java): Calculating a productivity bonus

Write a Java program making use of nested if statement, that calculates an employee's productivity bonus and prints the employee's name and bonus. Bonus is calculated based on an employee's productivity score as shown in table below. Productivity score| Bonus <=30| $50 31-69| $75 70-199| $100 >=200| $200 A productivity

ShoutBox - Java Example

You will create the ShoutBox class for your Virtual World. Your ShoutBox class will have a shoutOutCannedMessage() method that returns a String type. The shoutOutCannedMessage will use an Array or an ArrayList to store 10 messages of type String. For those of you that are more advanced with your Java skills, you could use a Hash

Java class for creating canned messages and random messages

You will create the ShoutBox class for your Virtual World. Your ShoutBox class will have two methods: Method shoutOutCannedMessage() will return type String. The shoutOutCannedMessage will use an Array or an ArrayList to store 10 messages of type String. For those of you who are more advanced with your Java skills, you could

Java program to convert English text to Pig Latin

Design and code a SWING GUI to translate test this is input in English into Pig Latin. You can assume that the sentence contains no punctuation. The rules for Pig Latin are as follows: a. For words that begin with consonants, move the leading consonant to the end of the word and add "ay". Thus, "ball" becomes "all bay"; "button

Java Classes Payment, Cash Payment, and Credit Card Payment

Define a class named Payment that contains a member variable of type double that stores the amount of the payment and appropriate accessor and mutator methods. Also, create a method named paymentDetails that outputs an English sentence to describe the amount of the payment. Next, define a class named CashPayment that is derived

Java Program and Ascending Integers

Write a Java program that inserts 25 random integers ranging from 0 to 100 into an ArrayList in ascending order. The program should then output the numbers and display the sum and average of the numbers.

Java program to write tax information to a text file

Write a Java application to accomplish the following task: Ask users to input the amount of tax they paid for the past 3 years. Write this information to a text file. After you are done, zip "compress" the text file and the java source file along with screen shot of your output, and submit.

Java Book Console Application

I need a complete Java code for the following beginner-level assignment. The code does not have to be pretty as long as it works... So here's the assignment: You run a small library. Ask the user to provide information for several books. The information must include the author, title and publisher of each book. Create a book

Integer Division and Modulus to Isolate Digits in an Integer

Given a large number we sometimes need to extract individual digits or sequences of digits from it. For example, given a four-digit year (2010) we may need to extract just the two-digit year or the century. The mathematical operators modulus (Java: %) and division (Java: integer division /) help us with this. Using the operators

Use Swing to Build a Payroll System

I'm working on a payroll application where I need to create a program using netbeans that tracks its employees pay data. The requirements are to record the weekly pay. If the employee works more than 40 hours a week, the employee earns 1.5 times the basic hourly pay for any time worked over 40 hours. The program should allow

Java Static Methods and Counting Numbers of Objects

public class Syntax2 { private int x, n; public Syntax2(int a, int b) { x = a; n = b; } public int sumofsquares(int x, int y) { return x * x + y * y; } public int nTimesProduct(int x, int y) { return n * x * y; } //test

Rewriting Codes in Java

The following lines of code compile and run: JOptionPane jop = new JOptionPane( ); jop.showMessageDialog("This is never done"); However, I am told the above code would not be written by an experienced Java programmer because the showMessageDialog method is static within the class. How would a pro would write it? Also

Java Class and Attribute Mixed Questions

1. Is there ever a reason to have a public attribute in a class? 2. What does it mean for a method to be overloaded? 3. Is it true or false that every class should have a toString( ) method that returns a String which is a text representation of the object. The method is not sent any actual. Is the toString( ) method ov

Simple Java Questions

Please explain these: 1. In general are attributes public and methods are private? 2. Suppose you must define a class called PlayingCard. What are two examples of attributes and two examples of behaviors for this class? 3. Define a single constructor for this class. public class Student { //attributes private

Stack and heap drawings

I was given the following questions regarding stack and heap drawings. How are stack and heap drawings done? How would one go about these questions? I am posting the questions as reference, but I am requesting information about how to do these types of questions generally, not to have them done for me. Stack and Heap Drawings

need help with this

First I'm new to java oop and i need help here's the problem Mick's Wicks makes candles in various sizes. Create a class for the business named Candle that contains data fields for color, height, and price. Create get methods for all three fields. Create set methods for color and height, but not for price. Instead, when height

Future of SVG

Hi, I need some help answering questions on SVG applications. Please help explain the following: 1) Sample code with explanation 2) Future of application 3) Conclusion

Java File Processing: Baby Names Trends

The file named babynames80s.txt contains the data for names in the 80s, pasted directly from the Social Security Administration web site. The numbers in the files have comma separators: 1 Michael 663,087 3.4512 Jessica 469,271 2.5448 2 Christopher 555,660 2.8920 Jennifer 440,697 2.3899 3 Matthew 458,596

Another Measurer in Java

Using a different Measurer object, process a set of Rectangle objects to find the rectangle with the largest perimeter. You need to supply the following class in your solution: PerimeterMeasurer Use the following class as your tester class: import java.awt.Rectangle; /** This program tests the measurement of rec

Java Practice

Declare an interface Filter as follows: public interface Filter { boolean accept(Object x); } Modify the implementation of the DataSet class in Section to use both a Measurer and a Filter object. Only objects that the filter accepts should be processed. Demonstrate your modification by having a data set process

Java Object Oriented Programming using Classes and Interfaces

A person has a name and a height in centimeters. Implement a dataset to process a collection of Person objects. Display the average height and the name of the tallest person. Use the following class in your solution: /** This class represents a person's name and height */ public class Person { private String name;

Statistics: simple linear regression

Write static methods - public static double sphereVolume(double r) - public static double sphereSurface(double r) - public static double cylinderVolume(double r, double h) - public static double cylinderSurface(double r, double h) - public static double coneVolume(double r, double h) - public static double coneSurface(d

Using the Java GUI

Write a program that draws a circle with radius 100 and center (200, 200). Ask the user to specify the x- and y-coordinates of a point. Draw the point as a small circle. If the point lies inside the circle, color the small circle green. Otherwise, color it red. In your exercise, declare a class Circle and a method boolean isInsi

Creating a Java One Line Code

I have the following code: public static void main (String [] args) { String s; boolean b; JOptionPane jop; jop = new JOptionPane(); s = jop.showInputDialog("Enter your email address"); b = s.matches(".*@.*..*"); if (b) { System.out.println("Address Appears Valid"); }

The inheritance concept in JAVA programming

NOTE: Please provide an explanation and example for the questions below, mainly C&D. Programming Language JAVA! A: Explain the inheritance concept in JAVA programming. B: Explain why the inheritance concept is useful for a programmer. C: Provide a written example that demonstrates how the inheritance concept is used. D: P

Java Question

Please provide a detailed and workable Java Netbean or Java Notepad project! Your consulting firm has been hired to develop a program that meets the following requirements. Your program must provide a menu to the user. This menu should list five different products of your choice. Once the user selects one product, they shoul

Java GUI determine if two rectangles overlap

Programming (Geometry : two rectangles) Write a program that passes the center coordinates, width and height of two rectangles from the command line as follows: java Exercise13_32 x1 y1 w1 h1 x2 y2 w2 h2 The program displays the rectangles in panel and a message indicating whether the two are overlapping, whether one

Java program to parse an arithmetic expression

Write a Java program that takes as input an infix arithmetic expression then transforms it to a postfix expression and based on a binary tree, it evaluates that expression. For instance, the program takes the following infix expression: (1 + 2) * (3 - 4) / (1 + 2) then transforms it to a postfix expression: 1 2 + 3 4 - * 1 2 + /

Java program to find a value at an index in an integer array

Could you help with this challenge? Write a main class named ArrayProgram that generates an array of fifty integers, all ranging from 1 to 100. The program should then prompt the user to enter an array index so the number in the array at that index can be found, but the user might not enter an integer. That would throw an Inp