> Online tutorial

primitive types in java

Primitive Types and Values
  • A primitive type is predefined by the Java programming language and named by its reserved keyword
PrimitiveType:NumericType boolean
NumericType:IntegralTypeFloatingPointType
IntegralType: one ofbyte short int long char
FloatingPointType: one offloat double
  • Primitive values do not share state with other primitive values.
  • A variable whose type is a primitive type always holds a primitive value of that same type.
  • The value of a variable of primitive type can be changed only by assignment operations on that variable and decrement operator.
  • The numeric types are the integral types and the floating-point types.
  • The integral types are byte, short, int, and long, whose values are 8-bit,16-bit, 32-bit and 64-bit signed two’s-complement integers, respectively, andchar, whose values are 16-bit unsigned integers representing UTF-16 code units.
  • The floating-point types are float, whose values include the 32-bit IEEE 754
    floating-point numbers, and double, whose values include the 64-bit IEEE 754
    floating-point numbers.
  • The boolean type has exactly two values: true and false.

type in java

Types and Values
There are two kinds of types in the Java programming language:
1)primitive types
2)reference types
  • There are, correspondingly, two kinds of data values that can be stored in variables, passed as arguments, returned by methods,
  • There is also a special null type, the type of the expression null, which has no name.
  • Because the null type has no name, it is impossible to declare a variable of the null type or to cast to the null type.
  • The null reference is the only possible value of an expression of null type.
  • The null reference can always be cast to any reference type.

object in java

What Is an Object?


Objects are key to understanding object-oriented technology.

Look around right now and you'll find many examples of real-world objects: your dog, your desk, your television set, your bicycle.

Real-world objects share two characteristics:
 They all have state and behavior. Dogs have state (name, color, breed, hungry) and behavior (barking, fetching, wagging tail). Bicycles also have state (current gear, current pedal cadence, current speed) and behavior (changing gear, changing pedal cadence, applying brakes). Identifying the state and behavior for real-world objects is a great way to begin thinking in terms of object-oriented programming.

Example: 

A dog has states-color, name, breed as well as behaviors -wagging, barking, eating. An object is an instance of a class.

Syntax


class name objectname=new classname();

java environment setup windows


Java Environment Setup:
Java SE is freely available from the link Download Java. So you download a version based on your operating system.
You can refere to installation guide for a complete detail.


Click Start > Control Panel > System icon to open System Properties dialog box.















what is java


Java is:
• Object Oriented
• Platform independent:
• Simple
• Secure
• Architectural- neutral
• Portable
• Robust
• Multi-threaded
• Interpreted
• High Performance
• Distributed
• Dynamic