Author: misamaliraza94
-
Java Comments
In this tutorial, you will learn about Java comments, why we use them, and how to use comments in right way. In computer programming, comments are a portion of the program that are completely ignored by Java compilers. They are mainly used to help programmers to understand the code. For example, Here, we have used…
-
Expressions, Statements and Blocks
In this tutorial, you will learn about Java expressions, Java statements, difference between expression and statement, and Java blocks with the help of examples. In previous chapters, we have used expressions, statements, and blocks without much explaining about them. Now that you know about variables, operators, and literals, it will be easier to understand these…
-
Basic Input and Output
In this tutorial, you will learn simple ways to display output to users and take input from users in Java. Java Output In Java, you can simply use to send output to standard output (screen). Here, System is a class out is a public static field: it accepts output data. Don’t worry if you don’t understand it. We will discuss class, public,…
-
Java Operators
In this tutorial, you’ll learn about different types of operators in Java, their syntax and how to use them with the help of examples. Operators are symbols that perform operations on variables and values. For example, + is an operator used for addition, while * is also an operator used for multiplication. Operators in Java can be classified into…
-
Data Types
In this tutorial, we will learn about all 8 primitive data types in Java with the help of examples. Java Data Types As the name suggests, data types specify the type of data that can be stored inside variables in Java. Java is a statically-typed language. This means that all variables must be declared before they…
-
Variables and Literals
In this tutorial, we will learn about Java variables and literals with the help of examples. Java Variables A variable is a location in memory (storage area) to hold data. To indicate the storage area, each variable should be given a unique name (identifier). Learn more about Java identifiers. Create Variables in Java Here’s how we…
-
Java JDK, JRE and JVM
In this tutorial, you will learn about JDK, JRE, and JVM. You will also learn the key differences between them. What is JVM? JVM (Java Virtual Machine) is an abstract machine that enables your computer to run a Java program. When you run the Java program, Java compiler first compiles your Java code to bytecode.…
-
Hello World Program
In this tutorial, you will learn to write “Hello World” program in Java. A “Hello, World!” is a simple program that outputs Hello, World! on the screen. Since it’s a very simple program, it’s often used to introduce a new programming language to a newbie. Let’s explore how Java “Hello, World!” program works. Java “Hello, World!” Program…
-
Java – Packages
Packages are used in Java in order to prevent naming conflicts, to control access, to make searching/locating and usage of classes, interfaces, enumerations and annotations easier, etc. A Package can be defined as a grouping of related types (classes, interfaces, enumerations and annotations ) providing access protection and namespace management. Some of the existing packages in Java…
-
Java – Interfaces
An interface is a reference type in Java. It is similar to class. It is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface. Along with abstract methods, an interface may also contain constants, default methods, static methods, and nested types. Method bodies exist only for…