Java: Most Popular Articles
These articles are the most popular over the last month.
How To Determine if Your Computer Is 32-Bit or...
Follow these steps if you want to find out if your computer is 32-bit or 64-bit.
Follow these steps if you want to find out if your computer is 32-bit or 64-bit.
Example Java Code For Building a Simple GUI...
An example Java class for building a simple GUI application. This program corresponds to the Coding a Simple Graphical User Interface - Part I
An example Java class for building a simple GUI application. This program corresponds to the Coding a Simple Graphical User Interface - Part I
Creating Your First Java Program
Are you ready to start programming in Java? Follow this step-by-step tutorial to learn how to write, compile and run Java programs.
Are you ready to start programming in Java? Follow this step-by-step tutorial to learn how to write, compile and run Java programs.
Declaring Variables
The use of variables is key to any program. Learn how to declare and initialize variables in Java.
The use of variables is key to any program. Learn how to declare and initialize variables in Java.
How to Generate Random Numbers
Learn how to generate random numbers using the java.util.Random class.
Learn how to generate random numbers using the java.util.Random class.
Using Constants
Throughout the lifetime of a variable its value might change many times. But what if you know the value will never change? Or more importantly you want to make sure it can't change? This is when you need to use a constant.
Throughout the lifetime of a variable its value might change many times. But what if you know the value will never change? Or more importantly you want to make sure it can't change? This is when you need to use a constant.
Using Java Naming Conventions
Using standard Java naming conventions will increase the readability of your code and make it easier to maintain.
Using standard Java naming conventions will increase the readability of your code and make it easier to maintain.
Simple Calculator Example Program
This program creates a simple calculator that performs addition and subtraction. It highlights how to implement the ActionListener interface in three different ways.
This program creates a simple calculator that performs addition and subtraction. It highlights how to implement the ActionListener interface in three different ways.
The Constructor Method
When a new instance of an object is created the constructor method is called. Examples of how to create constructor methods in Java are discussed here.
When a new instance of an object is created the constructor method is called. Examples of how to create constructor methods in Java are discussed here.
Download and Install the Java SE Development Kit
Make your first Java download the right one. Step-by-Step instructions on how to download the latest version of the JDK.
Make your first Java download the right one. Step-by-Step instructions on how to download the latest version of the JDK.
Accessors and Mutators
In object-oriented programming sometimes it's necessary to provide access to the private fields of an object. The use of accessors and mutators are a way to enable that access.
In object-oriented programming sometimes it's necessary to provide access to the private fields of an object. The use of accessors and mutators are a way to enable that access.
Create a Simple Window Using JFrame
How to use JFrame to create a simple window for a Java application.
How to use JFrame to create a simple window for a Java application.
Building Your First Java Applet
Follow this step-by-step tutorial to learn how to write, compile and run Java applets.
Follow this step-by-step tutorial to learn how to write, compile and run Java applets.
What Is Java?
Find out what Java is, who created it, and why people choose to program with it.
Find out what Java is, who created it, and why people choose to program with it.
A Simple Table Example Java Code Program
An example program showing how to use the JTable class
An example program showing how to use the JTable class
What Is Inheritance?
Learn about object inheritance and how it can be used to create a relationship between objects that share common characteristics.
Learn about object inheritance and how it can be used to create a relationship between objects that share common characteristics.
Error Message: Cannot Find Symbol
Cannot Find Symbol is a compile-time error.
Cannot Find Symbol is a compile-time error.
A Progress Bar Example Program
An example Java program showing how to use the JProgressBar
An example Java program showing how to use the JProgressBar
Reserved Words in Java
Here you will find a list of words that you cannot use as identifiers in a Java program.
Here you will find a list of words that you cannot use as identifiers in a Java program.
Aggregation
: Aggregation is a relationship between two classes that is best described as a "has-a" and "whole/part"
: Aggregation is a relationship between two classes that is best described as a "has-a" and "whole/part"
Simple Message Dialog Boxes Program
Example Java program code for how to make simple message dialog boxes using the JOptionPane class.
Example Java program code for how to make simple message dialog boxes using the JOptionPane class.
Designing and Creating Objects
Follow this step-by-step guide to learn how to design and create an object.
Follow this step-by-step guide to learn how to design and create an object.
Static Fields
Fields can be shared across all objects of the same type through the use of the static modifier.
Fields can be shared across all objects of the same type through the use of the static modifier.
Introduction to Object-Oriented Programming
Understanding object-oriented programming is fundamental to becoming a truly great Java programmer. The key concepts of objects are discussed in this article.
Understanding object-oriented programming is fundamental to becoming a truly great Java programmer. The key concepts of objects are discussed in this article.
The if-then and if-then-else statements
Use the if-then and if-then-else statements when your program needs to make a simple decision about what to do next.
Use the if-then and if-then-else statements when your program needs to make a simple decision about what to do next.
A KeyListener Example Program
An example program showing how to implement the KeyListener interface.
An example program showing how to implement the KeyListener interface.
Generating Unique Random Numbers
Sometimes the random numbers to be picked need to be unique.
Sometimes the random numbers to be picked need to be unique.
Java and the Mac OS X
Things are a little different for Java developers on Mac OS X. Find out how Java fits in with Apple computers.
Things are a little different for Java developers on Mac OS X. Find out how Java fits in with Apple computers.
What Is Unicode?
Learn about the Unicode standard, a global way to encode the characters that computers use.
Learn about the Unicode standard, a global way to encode the characters that computers use.
Using Packages
Learn how to include the functionality of packaged classes into your programs.
Learn how to include the functionality of packaged classes into your programs.
Install the Java SE Development Kit
Step-by-Step instructions on how to install the latest version of the JDK.
Step-by-Step instructions on how to install the latest version of the JDK.
Creating a Message Dialog Box - Part I
Learn how to use the JOptionPane class to make a simple message dialog box
Learn how to use the JOptionPane class to make a simple message dialog box
Object
An object is an instance of a class.
An object is an instance of a class.
File Dialog Box Program
Example Java program code to show how the JFileChooser class is used to present an open file dialog box and save file dialog box to a user.
Example Java program code to show how the JFileChooser class is used to present an open file dialog box and save file dialog box to a user.
Using the Switch Statement for Multiple Choices
Use the switch statement when you want your program to chose between a number of alternative options.
Use the switch statement when you want your program to chose between a number of alternative options.
What Is a Package?
Bring a sense of order to your classes through the use of packages.
Bring a sense of order to your classes through the use of packages.
Identifier
An identifier is simply a name given to a package, class, interface, method, or variable.
An identifier is simply a name given to a package, class, interface, method, or variable.
Method Signature
A method signature is part of the method declaration. It is the combination of the method name and the parameter list.
A method signature is part of the method declaration. It is the combination of the method name and the parameter list.
Using a KeyListener Interface
How to implement the Key Listener Interface.
How to implement the Key Listener Interface.
GridLayout Example Program
Example Java code to show how the GridLayout, the BorderLayout and the BoxLayout can be used to make a customizable graphical user interface for a simple calculator.
Example Java code to show how the GridLayout, the BorderLayout and the BoxLayout can be used to make a customizable graphical user interface for a simple calculator.
Common Runtime Error
See if you can debug a piece of code that produces one of the most fundamental Java runtime errors.
See if you can debug a piece of code that produces one of the most fundamental Java runtime errors.
Java Comments – Using Implementation...
Enhance the readability of your programs by using Java comments.
Enhance the readability of your programs by using Java comments.
Password Dialog Box Program
Example Java program code for creating a simple password dialog box.
Example Java program code for creating a simple password dialog box.
Example JavaFX code for Building a Simple GUI...
An example JavaFX application to show how to build a simple graphical user interface. The interface is the same as those built using Swing in part 1 and NetBeans GuiBuilder in part two.
An example JavaFX application to show how to build a simple graphical user interface. The interface is the same as those built using Swing in part 1 and NetBeans GuiBuilder in part two.
Input Dialog Box Program
Example Java program code to make several different types of input dialog boxes using the showInputDialog method of JOptionPane.
Example Java program code to make several different types of input dialog boxes using the showInputDialog method of JOptionPane.
CardLayout Example Program
A simple application showing how the CardLayout can be used to switch JPanels.
A simple application showing how the CardLayout can be used to switch JPanels.
Capturing Mouse Events Example Program
An example program showing how to implement the three mouse event listeners
An example program showing how to implement the three mouse event listeners
Primitive Data Types
The Java language provides eight primitive data types that define simple values a program can use.
The Java language provides eight primitive data types that define simple values a program can use.
GridBagLayout Example Program
Example code showing how the GridBagLayout layout manager can be used to position components.
Example code showing how the GridBagLayout layout manager can be used to position components.
Converting Strings to Numbers and Vice Versa
How to convert Strings to numbers and back again.
How to convert Strings to numbers and back again.
Working with the GridLayout
A look at how to use the GridLayout layout manager.
A look at how to use the GridLayout layout manager.
Building an Input Dialog Box
Find out how to use the showInputDialog method of the JOptionPane class to make different kinds of input dialog boxes.
Find out how to use the showInputDialog method of the JOptionPane class to make different kinds of input dialog boxes.
Superclass
A superclass is a class that has been extended by another class.
A superclass is a class that has been extended by another class.
BoxLayout Example Program
An example Java program showing a simple application using the BoxLayout.
An example Java program showing a simple application using the BoxLayout.
Modeless Dialog Program
Example Java program code showing two ways to make a modeless dialog using JDialog.
Example Java program code showing two ways to make a modeless dialog using JDialog.
Using Multiple Main Classes
Whilst learning Java the best way is to compile and run example code. Using multiple classes within a NetBeans project means you can keep all your code examples in one place and try them out independently of each other.
Whilst learning Java the best way is to compile and run example code. Using multiple classes within a NetBeans project means you can keep all your code examples in one place and try them out independently of each other.
Class
A class specifies the design of an object.
A class specifies the design of an object.
Java 7 (and beyond) and the Mac OS X
Since Java 7 the version of Java for the Mac OS X now comes from Oracle.
Since Java 7 the version of Java for the Mac OS X now comes from Oracle.
The Structure of Java Program - Hello NetBeans...
A basic look at the structure of a very simple Java program. This article gives a beginner a starting place for understanding the way the Java syntax builds to make a Java program.
A basic look at the structure of a very simple Java program. This article gives a beginner a starting place for understanding the way the Java syntax builds to make a Java program.
The String Literal
String Literals are used for representing string values in Java code.
String Literals are used for representing string values in Java code.
Java Is Case Sensitive
When coding in Java it's important to remember that Java is case sensitive. Here are some tips to avoid common case sensitivity pitfalls.
When coding in Java it's important to remember that Java is case sensitive. Here are some tips to avoid common case sensitivity pitfalls.
Data Encapsulation
Find out about data encapsulation, the most important concept of object-oriented programming.
Find out about data encapsulation, the most important concept of object-oriented programming.
Using the ArrayList
How to use the ArrayList class
How to use the ArrayList class
Coding a Simple Graphical User Interface - Part I
A step-by-step guide to manually coding a simple graphical user interface. Part two of this step-by-step shows how to code the same graphical user interface using NetBeans Gui Builder.
A step-by-step guide to manually coding a simple graphical user interface. Part two of this step-by-step shows how to code the same graphical user interface using NetBeans Gui Builder.
Fun With Strings Example Code
A Java program to show the String class in action.
A Java program to show the String class in action.
BorderLayout Example Program
An example program to show how to code a BorderLayout layout manager with assigned horizontal and vertical spacing.
An example program to show how to code a BorderLayout layout manager with assigned horizontal and vertical spacing.
FlowLayout Example Program
Example Java code for a program which provides a user with options to change the alignment and spacing of components in a FlowLayout layout manager.
Example Java code for a program which provides a user with options to change the alignment and spacing of components in a FlowLayout layout manager.
How to Prevent Inheritance
Some classes are designed not to be extended by other classes. Find out how to prevent a class being inherited by another.
Some classes are designed not to be extended by other classes. Find out how to prevent a class being inherited by another.
ItemListener Example Code Program
Example Java code showing the ItemListener event listener in action
Example Java code showing the ItemListener event listener in action
Association
The association relationship is a way of describing the fact that a class knows about holds another class
The association relationship is a way of describing the fact that a class knows about holds another class
JFileChooser Overview
An overview of the JFileChooser class showing the most useful methods along with some usage tips.
An overview of the JFileChooser class showing the most useful methods along with some usage tips.
JavaFX With FXML Using SceneBuilder and NetBeans
How to create a simple JavaFX FXML application using NetBeans and Scene Builder.
How to create a simple JavaFX FXML application using NetBeans and Scene Builder.
Composition
Composition is a relationship between two classes that is based on the aggregation relationship.
Composition is a relationship between two classes that is based on the aggregation relationship.
Manipulating Strings
The string class provides a few methods for manipulating Strings.
The string class provides a few methods for manipulating Strings.
Beginner's Guide to Using an IDE Versus a Text...
To learn Java you need somewhere to write your programs. Here's a guide to using an IDE versus a text editor.
To learn Java you need somewhere to write your programs. Here's a guide to using an IDE versus a text editor.
ActionListener
The ActionListener interface is an event listener for actions performed by some graphical components.
The ActionListener interface is an event listener for actions performed by some graphical components.
Relational Operator
A relational operator compares two operands to determine whether one is greater than, greater than or equal to, less than, less than or equal to the other.
A relational operator compares two operands to determine whether one is greater than, greater than or equal to, less than, less than or equal to the other.
Conditional Operator
Conditional operators are used to evaluate a condition that's applied to one or two boolean expressions.
Conditional operators are used to evaluate a condition that's applied to one or two boolean expressions.
Implicit Parameter
In a method call the implicit parameter is the object the method belongs to.
In a method call the implicit parameter is the object the method belongs to.
Reached End of File While Parsing
Reached end of file while parsing is a compile time error.
Reached end of file while parsing is a compile time error.
How to Generate Random Numbers (Part II)
Following on from the first article on generating random numbers in Java, find out how to generate random fractional numbers and boolean values.
Following on from the first article on generating random numbers in Java, find out how to generate random fractional numbers and boolean values.
Hexadecimal
Hexadecimal refers to a numbering system that has a base of 16. This means it uses all the numerals 0,1,2,3,4,5,6,7,8,9 as well as the letters A,B,C,D,E,F for each digit of a number.
Hexadecimal refers to a numbering system that has a base of 16. This means it uses all the numerals 0,1,2,3,4,5,6,7,8,9 as well as the letters A,B,C,D,E,F for each digit of a number.
Scope
Scope refers to the lifetime and accessibility of a variable.
Scope refers to the lifetime and accessibility of a variable.
Using the BorderLayout
An overview of the BorderLayout layout manager.
An overview of the BorderLayout layout manager.
Color Chooser Program
Example Java program code that shows the two static methods of the JColorChooser class in action to make a color chooser dialog box.
Example Java program code that shows the two static methods of the JColorChooser class in action to make a color chooser dialog box.
java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError is a runtime error.
java.lang.NoClassDefFoundError is a runtime error.
Main Method
The main method is the starting point for the execution of every Java application.
The main method is the starting point for the execution of every Java application.
Ternary Operator
: The ternary operator "?:" earns its name because it's the only operator to take three operands . It
: The ternary operator "?:" earns its name because it's the only operator to take three operands . It
How to Make a Password Dialog Box
Take advantage of the JPasswordField class to create a password dialog box.
Take advantage of the JPasswordField class to create a password dialog box.
Variable
A variable is a container that holds values that are used in a Java program.
A variable is a container that holds values that are used in a Java program.
Event Listener
An event listener receives and process events.
An event listener receives and process events.
MVC
MVC stands for Model-View-Controller
MVC stands for Model-View-Controller
Using the GridBagLayout
An overview of the GridBagLayout layout manager.
An overview of the GridBagLayout layout manager.
Arithmetic Operator
Arithmetic operators perform the same basic operations you would expect if you used them in mathematics (with the exception of the percentage sign).
Arithmetic operators perform the same basic operations you would expect if you used them in mathematics (with the exception of the percentage sign).
Coding a Simple Graphical User Interface - Part...
This step-by-step guide shows how to build the simple GUI application created in Coding a Simple Graphical User - Part I using the NetBeans GUI Builder.
This step-by-step guide shows how to build the simple GUI application created in Coding a Simple Graphical User - Part I using the NetBeans GUI Builder.
Overloading
Overloading is the ability to define more than one method with the same name in a class.
Overloading is the ability to define more than one method with the same name in a class.
What Is JavaFX?
Find out what JavaFX is and what it can be used to create.
Find out what JavaFX is and what it can be used to create.
A FocusListener Example Program
An example Java program showing how to implement a FocusListener interface
An example Java program showing how to implement a FocusListener interface
Octal
Octal refers to a numbering system that has a base of eight. This means it only uses the eight numerals 0,1,2,3,4,5,6,7 for each digit of a number.
Octal refers to a numbering system that has a base of eight. This means it only uses the eight numerals 0,1,2,3,4,5,6,7 for each digit of a number.
Float
The float data type in Java can be used to store floating point numbers.
The float data type in Java can be used to store floating point numbers.
Using the FlowLayout
A look at the most common properties of the FlowLayout layout manager.
A look at the most common properties of the FlowLayout layout manager.
Using Inheritance
Discover how a class can inherit the state and behaviors of another class.
Discover how a class can inherit the state and behaviors of another class.
Literal
A literal is a value that can be written directly into Java source code.
A literal is a value that can be written directly into Java source code.
Deprecated
When a new version of an API is released it's quite common for parts of it to become deprecated.
When a new version of an API is released it's quite common for parts of it to become deprecated.
Anonymous Inner Class
An anonymous inner class is a class with no name that will only have one instance created.
An anonymous inner class is a class with no name that will only have one instance created.
Creating a Message Dialog Box - Part II
See how to create a message dialog box when you want the user to confirm a message with a Yes or OK.
See how to create a message dialog box when you want the user to confirm a message with a Yes or OK.
Build a Simple Robocode Robot
It's time for some robot carnage.
It's time for some robot carnage.
Odd Magic Squares
Turtles, magic and squares will conspire to test your logic in this exercise.
Turtles, magic and squares will conspire to test your logic in this exercise.
Conditional Statements
Conditional statements enable a program to make a decision and preform an action based on that decision.
Conditional statements enable a program to make a decision and preform an action based on that decision.
Coding a Simple Graphical Interface - Part III
Looking at the JavaFX program structure
Looking at the JavaFX program structure
Void
The void keyword denotes that a method does not have a return type.
The void keyword denotes that a method does not have a return type.
Subclass
A subclass is a class that extends another class.
A subclass is a class that extends another class.
Statement
If expressions are akin to clauses in the English language, then statements are like sentences.
If expressions are akin to clauses in the English language, then statements are like sentences.
Deleting, Copying and Moving Files
How to delete, copy and move files using nio.2
How to delete, copy and move files using nio.2
Constructor Chaining
Constructor chaining occurs through the use of inheritance.
Constructor chaining occurs through the use of inheritance.
Bitwise Operator
Bitwise operators perform operations on the bits of their operands.
Bitwise operators perform operations on the bits of their operands.
Java Platforms
Java technology recognizes that developers build different applications based on the differing needs of their users. Discover the different editions of the Java platform available to developers.
Java technology recognizes that developers build different applications based on the differing needs of their users. Discover the different editions of the Java platform available to developers.
Event
An event typically occurs when a user interacts with a user interface.
An event typically occurs when a user interacts with a user interface.
Expression
Expressions are essential building blocks of any Java program. They are built using values, variables, operators and method calls.
Expressions are essential building blocks of any Java program. They are built using values, variables, operators and method calls.
Static Method
Static methods are created using the static keyword.
Static methods are created using the static keyword.
Declaration Statement
Declaration statements are used to declare variables.
Declaration statements are used to declare variables.
How to Make a Modeless Dialog Box
By using the JDialog class you can create custom dialog boxes that can be modeless.
By using the JDialog class you can create custom dialog boxes that can be modeless.
The try-catch-finally blocks
Java handles exception through the use of the try-catch-finally blocks
Java handles exception through the use of the try-catch-finally blocks
Main Class
A main class is a class that contains a main method
A main class is a class that contains a main method
Using Command-line Arguments
How to make use of command-line arguments in your Java applications.
How to make use of command-line arguments in your Java applications.
ListView and ComboBox Example Program
Example Java code showing how the ListView and ComboBox JavaFX controls can be used.
Example Java code showing how the ListView and ComboBox JavaFX controls can be used.
JavaFX CSS Example Program
This example code shows how to simply switch between two JavaFX stylesheets.
This example code shows how to simply switch between two JavaFX stylesheets.
Super
The super keyword enables a subclass to call the methods and fields of its superclass.
The super keyword enables a subclass to call the methods and fields of its superclass.
Creating A Simple Calculator to Handle Button...
Building an interface for a simple calculator program
Building an interface for a simple calculator program
How to Read and Write Byte Streams
Learn how to read bytes from a binary file one byte at a time.
Learn how to read bytes from a binary file one byte at a time.
Imperative Language
An imperative language uses a sequence of statements to determine how to reach a certain goal.
An imperative language uses a sequence of statements to determine how to reach a certain goal.
How to Handle Item Events
Handling item events triggered by ItemListener event listener through selecting and deselecting items from a JComboBox.
Handling item events triggered by ItemListener event listener through selecting and deselecting items from a JComboBox.
Operator
Operators are designated characters within the Java language that perform operations on arguments to return a specific result.
Operators are designated characters within the Java language that perform operations on arguments to return a specific result.
The Infinite Loop
Can you rewrite this Java code so that there is no longer an infinite loop?
Can you rewrite this Java code so that there is no longer an infinite loop?
Showing a Color Chooser Dialog
The JColorChooser class is used to create a detailed color chooser dialog.
The JColorChooser class is used to create a detailed color chooser dialog.
Concatenation
Concatenation describes the operation of joining two strings together.
Concatenation describes the operation of joining two strings together.
JOptionPane Option Chooser Program
An example Java application which allows the user to combine various JOptionPane options to show example dialog boxes.
An example Java application which allows the user to combine various JOptionPane options to show example dialog boxes.
The String Class
The String class lets you create and manipulate Strings.
The String class lets you create and manipulate Strings.
Playing With Wrappers
Play around with wrapper classes in this simple exercise.
Play around with wrapper classes in this simple exercise.
Reading and Writing Character Streams
How to read and write to a text file one character at a time.
How to read and write to a text file one character at a time.
Inheritance
: Inheritance enables programmers to define an "is-a" relationship between a class and a more specialized
: Inheritance enables programmers to define an "is-a" relationship between a class and a more specialized
Using the Arrays Class
How to use the Arrays class to manipulate Arrays
How to use the Arrays class to manipulate Arrays
How to Create a Simple Table
Adding a comboBox as an editor for a column
Adding a comboBox as an editor for a column
JLabel Overview
An overview of the JLabel class
An overview of the JLabel class
Source Code
Source code refers to the programming instructions used to create an application.
Source code refers to the programming instructions used to create an application.
Immutable
Immutable means unchangeable.
Immutable means unchangeable.
Declarative Language
A declarative language describes what it wants to accomplish rather than focusing on how to achieve that goal
A declarative language describes what it wants to accomplish rather than focusing on how to achieve that goal
Compound Assignment Operator
Compound assignment operators provide a shorter syntax to assign the results of the arithmetic and bitwise operators.
Compound assignment operators provide a shorter syntax to assign the results of the arithmetic and bitwise operators.
Disabling (or Enabling) the Java Plugin in a...
Here are the steps to disable (or enable) the Java plugin in a browser.
Here are the steps to disable (or enable) the Java plugin in a browser.
Literal Loop
Can you write loops using hexadecimal and octal literals?
Can you write loops using hexadecimal and octal literals?
