Java Tutorial

by Dinesh Thakur Category: Data Type

In the Following example LargestandSmallestnumber shows how to Find Largest and Smallest Number in an Array Using Java Example

 
by Dinesh Thakur Category: Data Type

In the Following example OddorEvenNumbers use mod operator to check if the number is even or odd. If the number divided by 2 and the reminder is 0 then number is even, otherwise the number is odd.

 
by Dinesh Thakur Category: Data Type

In the Following example AreaofRectangleExample shows how to Calculate Area of Rectangle is length * width.

 
by Dinesh Thakur Category: Data Type

In the Following example PerimeterofCircleExample shows how to Calculate Perimeter of Circle using 2*pi*r. where r is a radius of a circle.

 
by Dinesh Thakur Category: Data Type

In the Following example AreaofCircleExample shows how to Calculate Area of Circle using pi*r*r. where r is a radius of a circle.

 
by Dinesh Thakur Category: Data Type

Java's built-in data types called primitive data types. The primitive data types are int, byte, short, long, float, double, char, and boolean. A variable of any of these data types is called a primitive variable. We explain primitive data types in more detail as follows:



 
by Dinesh Thakur Category: Data Type

Operator is a symbol that represents some operation that can be performed on data. The operators are applied to operands (onto which processing is desired). These operands can be literals, variables etc. The operators supported by Java are as follows:

 
by Dinesh Thakur Category: Data Type

The Exit statement allows you to exit prematurely from a block of statements in a control structure from a loop, or even from a procedure. Suppose you have a For…….Next loop that calculates the square root of negative numbers can't be calculated ( the Sqr() function generates a runtime error,)

 
by Dinesh Thakur Category: Data Type

Automatic memory management, also known as automatic garbage collection, is the practice of allowing the language implementation to keep track of used and unused memory, freeing the programmer from this burden.

 
by Dinesh Thakur Category: Data Type

Command Line Arguments are parameters that are supplied to the application program at the time of invoking it for execution. We can write Java programs that can receive and use the arguments provided in the command line.

 
by Dinesh Thakur Category: Data Type

A variable is a place in memory where we can store a value. The Java programming language defines the following kinds of variables :

 
by Dinesh Thakur Category: Data Type

A variable in a program occupies some space in computer's memory where some value is stored. A value to be stored may be an integer, floating point number, a character or a string. However, now the question arises that how much memory is allocated to these values and what is the range of values that can be stored in it as different types of values don't occupy same space in memory. So to store these values, we require different data types depending on the needs of the application. The data type determines how much memory is allocated to store data and what operations can be performed on it. The Data type also defines the values that a variable can takes.



 
by Dinesh Thakur Category: Data Type

It is in two types. Those are,

 

1. Command line arguments

2. By using readLine() method

 
by Dinesh Thakur Category: Data Type

Vectors:- We know that Arrays are very useful when there is a need to use number of variables But There is a problem with Array they use only single data type or The Elements of array are always Same type For Avoiding this Problem Vectors are used.



 
by Dinesh Thakur Category: Data Type

We use the static keyword mostly for memory management, and the keyword goes with the class itself, not with a class instance. It may be:  

• A variable, or class variable
• A method, or class method
• A block
• A nested class
• Static Variable

 
by Dinesh Thakur Category: Operators and Expressions

Besides the assignment operator in Java has combined operators assignment. They contribute to reducing the amount of code as impracticable two operations by an operator. The combined operators have the following syntax:

 
by Dinesh Thakur Category: Operators and Expressions

In this example we reviewed six comparison operator <, <=,>,> =, == And ! =. Comparison operators always produce a boolean result value (true or false). Java has several comparison operator, which can be used for the comparison of any combination of integers, with float or symbols.

 
by Dinesh Thakur Category: Operators and Expressions

Java has two very useful operators. They are increment (++) and decrement (- -) operators. The increment operator (++) add 1 to the operator value contained in the variable. The decrement operator (- -) subtract from the value contained in the variable.

 
by Dinesh Thakur Category: Operators and Expressions

The assignment operator (=) is the most commonly used binary operator in Java. It evaluates the operand on the tight hand side and then assigns the resulting value to a variable on the left hand side. The right operand can be a variable, constant, function call or expression. The type of right operand must be type compatible with the left operand. The general form of representing assignment operator is

 
by Dinesh Thakur Category: Operators and Expressions

Arithmetic operators are used to perform arithmetic calculations. Java provides basic arithmetic operators. They are +,-, *, /, %. The different Arithmetic operators that were used in java programming.



 

Page 5 of 40



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.