Friday, 25 May 2012

Java Data Types

Litterls in Java

Data value that appears explicitly in our program are called Java Literals. The literals are stored in the variable's to use for long time.





The literals are comes under different types that could be integer,character,float,boolean,String and null type literals. I have given Example in image of four type literals.Lets take a look of rest types with them.

Integer Literals 
Integer Literals are the number type Literals.Like 2478 and -234 are the example of Integer Literals.
int a=25;

Float Literals
Float Literals are the Float type or real number Literals. 24.277 and -34.343 are example of Float Literals.
float fl=2.23;

Character Literals
Character Literals are Charecter type Literals. In that first you know about the ASCII values.The ASCII Character set include 128 character including the letters and Symbols.

Boolean Literals 
In java programming the 0 and 1 are also treated as literals.Where 0 is for false and 1 is equivalent to the true.
boolean active=true;

String Literals
Any group of charecters call the String Literals.Where the String Literals are the place where you can save any meaning full charecter set like name of a persone.
String name="Shiva";

Object-Oriented Programming in Java

If a problem is solving in the term's of classes and object's it is called object oriented programming.The object oriented programming satisfy some of  features like polymorphism,encapsulation,inheritance and  abstraction.

    Object oriented programming include's data and function's at a same place in the form of object's.java include package,interface's,classes and all the feature of object oriented programming to satisfy the object Oriented programming feature's.
    The object's are instance of the class.


 

The instance always has same fields and methods like class.

Java features

The Features which make's java as most power full language.


Simple:The java is a simple language because it has different simple features.The java codes are simple and does not contain any pointer concept in explicit way.Automatic memory allocation and deallocation with strong memory management provides us bug free system.

Performance:Garbage collector and lightweight thread process enhance the performance of java programs.An another technique of it that is just in time compilation technique that improves the performance of java programs.

Eliminating week point's of C:.It does not use memory pointers.Java does not use preprocessor.

Security:

Platform Independent or Portable:

Byte Code:Byte code are always the form of 0 and 1 that is ease to understood by any machine. 

JVM:Java vertual machine make's a java program platform independent .

Object Oriented:

Robust:

Multi Threading:

Architectural Nature:

Distributed and Dynamic:Java supports HTTP and FTP protocols and also supports other protocols like TCP/IP and IP protocol's.These protocols help's the java to enable for the network to use remote access.Different networking features with servlet and applet's on the internet.

Metadata:

Class

A class is a prescription for a particular kind of object.We can use the class definitions to create objects of that class type.Class is also an example of encapsulation because it include that feature.This is to create objects of that class type.That include all the component specified belonging to the class.
The thing's that we can include in our class definition are fields(variables),methods.



Similarly a class is a collection of entities that have similar characteristics or we can say that a class provides definition for an object.

      class Demo
         {
           int demo1;
           int demo2;
          void DemoMethod(int dm1,int dm2)
               {
                 demo1=dm1;
                 demo2=dm2;
                }
           void DemoShow()
               {
                 System.Out.println("Demo1:"+demo1"Demo2:"+demo2);
                }
            }


In this example Demo is name of a class and demo1,demo2 are variables and the DemoMethod, DemoShow are methods of Demo class.

Object

Objects in java are grouping of different features in a single form.We can find it as encapsulation.Because encapsulation is a need of Object based programming which must satisfied by any object based programming language.
The definition we can use -
                                         "An object is a bundle of methods,functions and variables".
         The object in real world like dog,bicycle or any book,all have there own features.Real World Objects Show there features like dog have color,breed  and can bark.there all are function and features of a dog object in a real world.Grouping of different features make an Object.


In any Object based programming language Objects have methods and functions which have similar characteristics.In java it can possible by making class in a program,it happen every time because we can not work on java with out class and objects.Java is also an Object oriented language.

Wednesday, 23 May 2012

Byte Code and .class file

Byte Code

Byte codes are binary instructions for the java interpreter in java.

.class file

The bye code instruction which are understand by computer machine.The .class file are always in form of byte code.The .class file are generat by the java compiler.

JVM


 Java Virtual Machine(JVM) is combination of operating system and java interpreter.We can run our java programs on a wide verity of computers using a range of operating system.This can be possible here because, the JVM does not execute directly java program on our computer.It run on JVM which is implemented inside computer by java java interpreter.

The  java program that we converts by java compiler to binary file consisting by java compiler to byte codes. The java interpreter inspects the byte codes,check it out to ensure that it is safe to execute and then it execute.
The  java interpreter can run standalone or it can be part of a web browser where it can be in walk to run applets in a web page

Introduction about Blog

                                                         This blog is completely dedicated to Java Programming including the Program Code examples in easy way.This feature makes the learning java more interactive for learners.