Posts

Decision Making Statements

A java program has many statements, these statements are executed sequentially. If a program has two or more conditions and user want to perform a particular condition which satisfy user's need, then Decision Making concept is used. JAVA has some following Decision Making Statements: IF statements switch statements if statements: if statements are used to check the condition in true or false. Simple if statement if-else statement if-else-if ladder Nested if Simple if: If condition is true then particular statement block will be executed otherwise skipped. syntax: if(condition){                 //block of statement; } Program: public class Eligibility{           public static void main(String[] args){                         int age = 19;     ...

Variables and Identifier

Variable is the part of memory where we store any value. When we want to store any value then in spite of remembering that complex address where value is located, we give a name that address, that is variable. Variables store values temporary which is to be used in further program. Syntax: Data type variable = value; Data type variable1, variable2; Example: int val1, val2, val3; int val1 = 11, val2 = 22; Naming Rules: Variable name’s first character must be alpha. Keywords are not allowed as variable name. Special symbols are not allowed. Variable names are case sensitive i.e. upper & small cases have different meaning. Blank space is not allowed in a variable name. Underscore can be used at the place of space. Types of Variable: Local Variable Static Variable Instance variable Local Variable: Local variables are declared within the method or block. Variables are initialized when block is executed and destroyed ...

Data Types

Data is used to define the value which is to be stored for a variable. Type and size is to be determined in Data type. Types of Data Types:     •Data Type     •Primitive     •Integer     •Floating     •Character     •Boolean     •Non-primitive     •ArrayList     •Linklist     •Stack     •Queue                                                        Primitive Data Types : Primitive data types are already available in java environment. Size and range are fixed which can't be modified. It is divided into 4 Categories - Integer Types Floating-Point Character Boolean ...

First JAVA program

First Program: class Demo{                 public static void main(String[] args){                                 System.out.println("Hello World"); } Output : Hello World! Steps to write a java program: First you have to install jdk in your system. Then set the javac path :  Copy the path where you installed the jdk. e.g. C:\Program Files\Java\jdk1.8.0_121\bin Now go to properties of my computer. In advanced menu click on environmental variable and set path. Now write a java program and save it with program name with .java extension. For compile the program we write: javac program_name; If program is successfully compiled then we can execute the program using following command: java progra...

What is JAVA?

JAVA is the most popular programming language and a platform. JAVA is high level, portable, robust and object-oriented language. JAVA was designed in early 1970's. It was originally developed by Sun Microsystems and currently owned by Oracle. JAVA is used to create windows apps, utility programs, networking essentials and many more. Features of JAVA: Simple Object-Oriented Robust Secure Platform independent Portable Multi Threading Simple: Java is more simple than C++. Syntax are easy to understand. There are no more complex concept like Operator overloading and Pointers in Java. Object-Oriented: Java follows the concept of object-oriented where each object has some properties and behavior.Object-Oriented concept has some features like class, object, Data encapsulation, Inheritance, Polymorphism etc. Robust:  Robust property helps to eliminate errors using check errors at compile time as well as run time and Exception Handling. Secure:  Secu...