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

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

Type casting is the process of "casting"(Casting mean ‘conversion’ of value to another type) of value to one type to another type of variable.

 
by Dinesh Thakur Category: Data Type

This JavaFactorialUsingRecursion Example shows shows how to generate factorial of a given number using recursive function. Recursive are the function which calling method itself. the java recursion factorial example demonstrate recursive function call to find factorial. In mathematics, factorial is defined as n! = n*(n-1)...2*1. e.g. If we want to calculate factorial of 10 , then its factorial value is (10*9*8*7*6*5*4*3*2*1) = 3628800.



 
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 Volume of a Sphere in Java Example , Math.PI is used because it denotes the value of pi i.e. 3.1414. Math.pow(r,3.0) is used for computing y3

 
by Dinesh Thakur Category: Data Type

Variables are useful when you need to store information that can be changed as program runs. However, there may be certain situations in the program in which the value of variable should not be allowed to modify. This is accomplished using a special type of variable known as final variable. The final variable also called constant variable. It is a variable with a value that cannot be modified during the execution of the program.



 
by Dinesh Thakur Category: Data Type

step 1: Read a character

step 2: Cast it into byte and store in b

step 3: Print b

step 4: Exit

 
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

When the block is declared without using any modifier, then it is treated as the non-static block is first executed before the constructor is executed. Non-static block directly access the static variable and instance variable.

 

Page 8 of 80



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.