Operators in Java

Operators In Java Operators are symbols that are used to perform some operations on the operands.They are used to manipulate primitive Data types.Combination of operands and operators are known as expression.Java provides a rich set of operators to manipulate the variables.There  are three types of operators in Java. 1. Unary operators 2. Binary operators 3. […] Continue reading →

Modifiers in Java

 Modifiers in java There are two types of modifiers in java. 1.Access modifiers 2.Non-access modifiers. 1.Access modifiers Java provides a number of access modifiers to set access levels for classes, variables, methods and constructors. The four access levels are: Visible to the package is No modifiers are required. Visible to the class only (private). Visible […] Continue reading →

Literals in Java

Java Literals Literal is also known as constant. A literal is a constant value which is compatible to a data type, a literal is used to assign a value to variable, to compare values or define constants. There are many types of constants (literals). They are: Boolean literals Integer literals Floating literals Character literals String […] Continue reading →

Variable in Java

Variable in Java Variable is a name of memory location. Variables are used to hold the value. Example int data=50; //Here data is variable Types of Variable There are three types of variables. 1.Local variable 2.Instance variable 3.Static variable 1.Local variable: A variable that is declared inside the method is called local variable 2.Instance variable: […] Continue reading →

Data Types in Java

Data Types When we create a variable in the program then we reserve some space in the memory. So, Data types are used to allocate memory to a variable. By assigning different data types to variables, we can store integers, decimals or characters in the variables.The following should be understood for every Data type: 1. […] Continue reading →

Tokens in Java

What is Tokens?Which types of Tokens used in Java. In a Java program, all characters are grouped into symbols called tokens. Tokens are the various Java program elements which are identified by the compiler. A token is the smallest element of a program that is meaningful to the compiler. When you compile a program, the […] Continue reading →

Prime Number in Java

Prime no. A number is called prime number if its not divisible by any number other than 1 or itself and you can use this logic to check whether a number is prime or not.It is called a composite number.   //Write a program of Prime Number in Java import java.util.*; class Prime { public […] Continue reading →

reverse the digits in Java

Reverse digits in Java: This program prints reverse of a number i.e. if the input is 1234 then output will be 4321.        //Write a program in Java to reverse the digits import java.util.Scanner; class ReverseNumber{ public static void main(String args[]) { int n, reverse = 0; System.out.println(“Enter the number to reverse”); Scanner […] Continue reading →

Draw different shape in Java

//Write a program to draw different shape in Java import java.applet.*; import java.awt.*; public class DrawStuff extends Applet { int width, height; public void init() { width = getSize().width; height = getSize().height; setBackground( Color.black ); } public void paint( Graphics g ) { g.setColor( Color.blue); g.drawRect( 30, 40, 150, 20 ); g.setColor( Color.pink ); g.fillRect( […] Continue reading →

Application Programming Interface (API) in Java

An application programming interface is a collection of prewritten packages, classes, and interfaces with their respective methods, fields and constructors. Similar to a user interface, which facilitates interaction between humans and computers, an API serves as a software program interface facilitating interaction. In Java, most basic programming tasks are performed by the API’s classes and […] Continue reading →
Page 1 of 42123456»102030...Last »