ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Java Programming

Updated on February 25, 2014

Why is the concept of inheritance important in object-oriented programming?

There are different kinds of objects that are in common, so in Java the object-oriented programming allows these classes to in herit these similar objects from other classes. An example of this would be people. You have males and females. Then you have their height, weight, age, color of hair, eye color, and so on. With inheritance, when creating a new class but there is already a class which includes some of the code you want to use. you can derive your new class from that existing class. The concept of inheritance is important in object-oriented programming so the designing of the software is able to create the logical class of the hierarchies and also so that it can be better to organize so that you are able to reuse the code. By this, makes the programs much easier to design for the programmers. The programmer does not need to rewrite the same code over and over again for each class types. They could easily reuse that code from other class sections to save so much time.

Explain the basic steps necessary to create, compile, and execute a Java program.

What software is necessary to accomplish this?

The Basic steps necessary to create, compile, and execute a Java program that I have downloaded the Java Kit (JDK) onto my computer.

The basic steps in a Java program consists of 5 steps.

1. Create a Java Program by typing the code in any text editor such as notepad. However, to make life easier, you could be able to download the Java Development Kit (JDK) and this will get you started in creating and editing programs.

2. Compiling a Java Program into Bytecodes. To compile the command you could use the javac command which is the Java compiler.

3. Loading a program into the memory. The Java Virtual Memory (JVM0 gets placed into the memory so that it could be executed.

4. Bytecode verification. all the classes are loaded up and this examines the results to see if there is any errors and doesn't violates the Java Security Restrictions (JSR)

5. Execute.

The software that is necessary to accomplish the Netbeans IDE (Integrated Development Environment)

How might algorithms be beneficial in your future profession?

Using top-down, stepwise refinement, create an algorithm for making toast, frying eggs, baking a cake, or ordering pizza.

I am not sure how you want these steps to be so I had used it in psuedocode which I remember from my previous class in introduction in programming

Ordering Pizza:

Decide the type of pizza

Decide pizza size

Search phone number of the pizza store

IF Search on Internet

Then type in Url address

Log on site

click on size of pizza

tick what you would like on pizza

add on orders (ie soda, chicken wings)

IF Search on yellow pages

Then open book to first letter of company

Search company

Pick up the phone receiver

Dial number of pizza store and wait for reply

Get the employee prompts for this order

Set your order requirements (type and slices)

IF Order is placed successfully then

Say Thank you and Goodbye


Repeat the order again

Confirming the order

Put down the receiver on the phone.

Wait for pizza delivery

Algorithms are steps, patterns, or sequence to help improve the functions of anything, making it work at its most efficient way. This helps the computer programmers so that they could remember what program is needed. I think algorithms help me understand all the steps that is required. Without an algorithm is is quite easy to make a mistake or error.

How are looping statements different from selection statements?

Explain when you would use a while loop rather than a for loop and vice versa. Provide an example of one such instance.

Going through a fixed set of iteration, you would use a 'for' loop. Basically when using a for loop is to set an initial value so that it makes the code more: An example of this would be:

for (int i=0;i<10;i++)

sum += values[i];

When you do not know the number (s) of iterations, a 'while' loop is basically a pretest. A good example of this would be:

while( ! rs.isLast())


sum += rs.getInt("field1");;


A loop will execute a set of code many times over where a selection statement is used to determine which code to execute. IF and switch statements are selection of a statement that will direct the programer's program based on a decision. WHILE and FOR statements are loops that will execute the same code several times.

How would you explain how arrays are used?

If you were explaining an array to a friend who is learning Java, how would you do so? Provide at least one concrete example in your response. Discuss your definitions and explanations with your classmates.

An array in Java Programming is a group of variables, which is also called elements in each array, it contains the values of all of the same type. The objects that arrays have also holds a fixed number of the values of reference type. They could also be primitive types.

a [0] // "0" would be element 1

a [1] // "1" would be element 2

a [2] // "2" would be element 3

a [3] // "3" would be element 4

The numbers that are in the brackets are elements of that array. The 'a' is the array. The '0' element would actually be the first element. Therefore, according to my above example there are 4 elements. Every array object knows its own length and it stores in a length instance variable. When the types of arrays and the square brackets combine, which is at the beginning of the declaration, all identifiers in the declaration are array variables. Examples below

String [] a = new String [50]; // Create array a

String [] b = new String [25]; // Create array b

How might array applications be useful in your everyday work?

Describe a situation in which you could implement an array. Describe how items in the array might be searched for or sorted.

I am sure that any programmer can find a way to implement an array like structure, which are different real life situations, justifying the need to sort or list information with same types of data. An example is that perhaps I wanted to do a search for vehicles that are for sale. So using the array, it could be created for different styles of vehicles such as Nissan, Toyota or Honda. Another array can be created to list something like the year it was made 200, 2001, or 2002 and so on. There could be another list could be created like how much the vehicles are cost such as 10,000., 7,000.00, or 5,000.00 and so on. I would say these are just some examples where an array can be used in a real-life situation because everybody is looking on the Internet and looking for vehicles and what kind they are interested in and so on.

What tips have you discovered while completing the Inventory Program?

When I first started out with Java Programming, and looked at the sample programs I thought I would never be able to do this. I then thought I will never know how these programs do unless I start working on it step by step. So the tip that I have to offer my fellow classmates is that when you are working on Java, the best thing to do is to calm down and try to focus on the program. I am a person that would take things kind of fast sometimes and if I don't know something I would panic and my mind would get discombobulated. I had managed to calm down by trying to relax. Also if you think you can't do it, the best thing to do is at least try it because then you could say that you at least tried it. I slowly understand the IDE software and there are a lot that still don't know because I haven't used certain functions yet. I was mainly focusing on the page itself where I place the program. I also realized that when I worked on my Introduction to Programming class last semester on Psuedocode, it is similar, for those who took this class, you will know what I am talking about. I also panicked with Introduction to Programming. Also another good tip on Java programming is that use the {} symbols for separating those pieces of the program and also use the // symbol with following programmer text for their use so they know what they wrote.

Why are the use of GUIs and graphics beneficial in programming?

There are benefits in programming when using GUI (Graphical User Interface) and graphics. Some are unbeneficial, you try to not to have otherwise it will not work properly. People are used to the GUI because a long time ago you have to command the computer through text. Now it increases productivity when using the GUI on a computer, the graphic artist can create that same manual in only days. If you know what you are doing, you can make use of your computer that is properly design GUI. Today's day of age people computers benefits everyone. To add to that, the Graphical User Interface also gives greater access to the user because it is gives more capability and it will definitely be much quicker.

New Guestbook Comments

    0 of 8192 characters used
    Post Comment

    No comments yet.