Java do-while Loop
A loop is a block of statements that are repeated. There are three main loop control structures available in Java: for, do and while. This article provides example of while loop code. More ...
Comparing Two Text Strings in a Java Program
One task performed frequently in a Java program is to compare two strings. To accomplish this you would use the String object's equals() method. This article provides Java code to compare the text in two strings. More ...
Concatenate Strings in a Java Program
Java uses the concatenate (+) operator to paste two or more strings together. This article provides Java code to concatenate the strings "first text " and "second text". More ...
Java if else if else Control Statement
Some instructions tell the computer to test a variable and to follow a group of instructions based on the result of that test. The nice thing about an if else if else statement is that you can use as many else if sections as you require. You could have an else if section for every possible condition value. More ...
Basic Java Variables
In Java information that can be changed as the program runs is stored in variables. A variable is created with a statement that has the type and the name of the variable, and sometimes the value of the information being stored. More ...
Reading Files with Java
Without the ability to read files, your application would be severely limited. In this article I show you; how to use the JfileChooser dialog box to select a file, how to display the contents of the file in your applications window, and how to scroll the Window. More ...
Display Text in a Java Program
In computer programming, a letter or digit is called a character and a collection of letters or digits that make a phrase, sentence, or paragraph, is called a string. Example code to display a string in java is provided in this article. More ...
Java switch case Control Statement
The if else statement tells the computer to run one set of instructions based on one result of a test, and a different set of instructions based on a different result of the test. But a switch case statement can run a different set of instructions based on any value or expression provided to the switch command. More ...
Display Variable's value in Text in a Java Program
Java uses the concatenate operator (+) to paste two or more strings together. However, you can also use the concatenate operator to display the value of a variable with a String. Java will automatically convert the integer values to Strings for display. More ...
Change the Case of Text in a Java Program
If you compare two characters or two strings, Java will say they are different if all the characters are not the same case. To make a comparison without consideration for case, you can first convert all the characters in a string to lower case using the String objects toLowerCase toUpperCase method. More ...
Java while Loop
A loop is a block of statements that are repeated. There are three main loop control structures available in Java: for, do and while. This article provides example of while loop code. More ...
Your First Java Menu
Many times the user of a sotware application performs functions by selecting items from a menu. In this article I give you an overview of the Java event model and how to create a Java program with a simple menu. More ...
Passing Arguments to a Java Application
In this article I use a very short example program to demonstrate several basic principles of Java programming; how to pass arguments to a Java application, how to convert a string to an int, and how to use an if structure. More ...
Determine the Length of a Text String in a Java Program
Java uses the .length method to return the length, in characters, of the text contained in a String object. In this article is the Java code to determine the length of a text string. More ...
