learn java

Java Technology Java technology is both a programming language and a platform. In the Java programming language, all source code is first written in plain text files ending with the .java extension. Those source files are then compiled into .class files by the javac compiler. A .class file does not contain code that is native […]

Input and Output – Java tutorial Pages like these in the tutorial as well as your resume stored on your computer are called data files. The toolbars at the top of your computer screen are called program files. In Java, files like theses are part of the File class. These, however, cannot be opened, processed, […]

Introduction to Exception Handlers – Java tutorial An exception is an unexpected condition. To know how to create exceptions, you gotta learn to expect the unexpected. Most common errors are math error. Consider the program below:public class MathError {   public static void main(String[] args) throws ArithmeticException   {     int num = 13, denom = 0, result; […]

Abstract Class – Java Tutorial An abstract is a class that you cannot create any concrete objects, but you can extend from. You use the keyword abstract when you declare the class. You can also create methods that are abstracts that can be inherited. Below is an example of an abstract class. public abstract class […]

Super classes and subclasses – Java Tutorial When you are using superclasses and subclasses, it is important to remember that two constructors execute. The base, or parent, class constructor MUST execute prior to the extended, or child, class constructor. For example: A Base Class public class ABaseClass { // Base constructor that executes first public […]

Inheritance and class extensions – Java Tutorial Inheritance is where you can apply a general category to a more specific one. If you remember back in Lesson Three, we used the constructor Student oneStudent = new Student(). This is how inheritance works. We could also type Student studentTwo = new Student() and Student thirdStudent = […]

Now it’s time to have some fun. Everything that you’ve learned so far can be put into action by the use of applets. To see what you’ll start creating, click here. This applet requires an HTML document to host the applet, labels to produce the text output, codes to produce text fields and buttons, and […]

Advanced array techniques – Java tutorial Arrays can be very useful when it comes to sorting. If you are sorting from the lowest value to the highest, you are sorting in ascending order. If you are sorting the highest value to the lowest, you are sorting in descending order. Another sorting method called bubble sort […]

Next, we will learn how to declare and initialize arrays, use subscripts with arrays, declare an array of objects, search an array for an exact match, pass an array to a method, and use the length field. An array is several data items that have the same type and name. You declare an array by […]

Now we’ll take a look at input, selection, and repetition. All the programs we will be writing be interactive, which means you and the programs you write will exchange communication. This will occur while the programs are in run time, or while the program is running. To provide the method to receive input, you must […]