Tag Archives: Java-Basics

Java Identifiers

In programming languages, identifiers are used for identification purpose. In Java an identifier can be a class name, method name, variable name or a label. For example : public class Test { public static void main(String[] args) { int a = 20; } } In the above java code, we have 5 identifiers namely : Test : class name.… Read More »

Comments in Java

In a program, comments take part in making the program become more human readable by placing the detail of code involved and proper use of comments makes maintenance easier and finding bugs easily. Comments are ignored by the compiler while compiling a code. In Java there are three types of comments: Single – line comments.… Read More »

Basic Operators in Java

Java provides a rich operator environment. We can classify the basic operators in java in following groups: Arithmetic Operators Relational Operators Bitwise Operators Assignment Operators Logical Operators Let us now learn about each of these operators in details. Arithmetic Operators: Arithmetic operators are used to perform arithmetic/mathematical operations on operands. Addition (‘+’) :  Adds two… Read More »

Access Modifiers in Java

As the name suggests access modifiers in Java helps to restrict the scope of a class, constructor , variable , method or data member. There are four types of access modifiers available in java: Default – No keyword required Private Protected Public Default: When no access modifier is specified for a class , method or… Read More »

Classes and Objects in Java

Classes and Objects are basic concepts of Object Oriented Programming which revolve around the real life entities. Class A class is a user defined blueprint or prototype from which objects are created.  It represents the set of properties or methods that are common to all objects of one type. In general, class declarations can include… Read More »

Beginning Java programming with Hello World Example

The process of Java programming can be simplified in three steps: Create the program by typing it into a text editor and saving it to a file – HelloWorld.java. Compile it by typing “javac HelloWorld.java” in the terminal window. Execute (or run) it by typing “java HelloWorld” in the terminal window. Below given  program is… Read More »

Setting up the environment in Java

Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented etc. Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of computer architecture.The latest version is Java 8. Below are the environment settings for both Linux and Windows. JVM, JRE and JDK  all three are platform… Read More »

Variables in Java

A variable is the name given to a memory location. It is the basic unit of storage in a program. The value stored in a variable can be changed during program execution. A variable is only a name given to a memory location, all the operations done on the variable effects that memory location. In… Read More »