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 19952Java 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.

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 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

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

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 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

Vector class in Java

Create a Vector class implementing a number of vector operations as methods along with a testing program to verify the class is working. 1. Create a Vector class incorporating the following features: a. a constructor taking an array of doubles as an argument b. a toString method returning proper vector notation, e.g < 1.0, -1

Java MyLinkedList with insertSortNoDuplicate Method

Write a Java class MyLinkedList that includes implementation of: i. int insertSortNoDuplicate(Object object) that will insert an object at correct position in the ascending (increasing) order. The method also will return -1 if the given object already exists in the current list, otherwise returns 0. ii. Iterator getIterato

Write a student class in Java that implements the Comparable interface.

Write a student class in Java that implements the Comparable interface. The class has: - Two instance variables studentId (String) and gpa (double). StudentId would contain six-digit Student Id, and the value of GPA is between 0.00 and 4.00. - Two constructors with the following headers: --> public Student(String studentId,

Solving: JAVA Questions

- The linked list that follows represents a stack. After we push the player (5, Joe, Sonic) onto the stack, what are first and last items on the stack? (7,Ajay, NFL) -> (3, Sarah, Mario) -> (9, Jin, Golf) -> null head (7, Ajay, NFL0 and (9, Jin, Golf) (5, Joe, Sonic) and (9, Jin, Golf) (3, Sarah, Mario) and (5, Joe

Java Array Coding

3- In a two-dimensional array, every row must have the same number of columns. true or false 5- How do you access the element of array a located at row 2 and column 4? 9- An ArrayList can be returned by a method. True or False 11-Is is possible to declare and instantiate an ArrayList of a user-defined class type. True o