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 ...
Java Byte, Short, Long, and Double Variable Types
In Java, as in other programming languages, information that can be changed as the program runs is stored in variables. A primitive variable type is predefined by the language and is named by a reserved keyword. There are eight primitive data types supported by the Java programming language. More ...
Display a Line Break in Text in a Java Program
In computer programming, a collection of letters that make a phrase, sentence, or paragraph, is called a string. Within a string there may be special characters that are used to produce things like tabs, backspaces, and carriage returns. A line break is created using the newline special character. More ...
Display a Backslash in Text in a Java Program
Within a string there may be special characters that are used to produce things like new lines, tabs, backspaces, and carriage returns. A special character is prefixed by a backslash. More ...
Java if Comparison Statement
A computer program is a list of instructions for the computer to follow. Some instructions tell the computer to test a variable and to follow a group of instructions based on the result of that test. The most basic conditional test is the if statement. More ...
How to Install JDK 8 on Windows and Get Started with Java Programming
Java is one of the most popular programming languages in use, particularly for client-server web applications, with nine million developers, and more than three billion mobile phones run Java. All you need to learn to program Java is the free JDK (Java Development Kit). More ...
Display Quotation Mark in Text in a Java Program
To define a String in Java, you enclosed it within quotation marks. These quotation marks are not shown when you display the string. More ...
Locate Text Within Text in a Java Program
In Java 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. Java uses the String object's .indexOf method to locate one string within another. 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 ...
How to Use Boolean Expressions in Java
A Java boolean can have one of two values: true or false. In some languages, such as C or C++, integer values can be treated as a boolean, with 0 equal to false and any other value equal to true. Not so in Java. In Java, you can't convert between an integer type and a boolean type. 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 Ternary Operator Control Statement
The ternary operator (?) is often confusing to beginners. The ternary operator is used to assign one of two values to a variable based on a conditional test. 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 ...
Java Keywords
The Java programming language has 50 keywords. Each keyword has a specific meaning in the language. You can't use a keyword for anything other than its pre-assigned meaning. The following table lists Java's keywords. More ...
