Tuesday 22 July 2014

Java : Few Important Points

A simple program in java
  • Imp Point 1
 class Hello
{
    public static void main(String args[])
                  {
                      System.out.println("Hello how are you?");
                   }

}  If you want to run this program ,you have to save this file with .java extension.
So you can save it with Hello1.java or Hello.java or even .java
means .java is also valid .
  •  Imp Point 2
if you declare a class public then file name should be the same as the public class name with .java extension.
public  class Hello
{
    public static void main(String args[])
                  {
                      System.out.println("Hello how are you?");
                   }

}
Means you have to save this with the name Hello.java only
  •  Imp Point 3
A single .java can contain only one public class and any  no of private classes.You cant have more than one public class if you do,you will get an error.
  •   Imp Point 4 

public  class Hello
{
    public static void main(String... args)
                  {
                      System.out.println("Hello how are you?");
                   }

}
Instead of args[] array ,use can use varags(...).
  •   Imp Point 5

public  class Hello
{
   static public  void main(String... args)
                  {
                      System.out.println("Hello how are you?");
                   }

}
Instead of public static void main ,you can write static public void main but you cant do void public as it will effect function signature.
Modifier Return Type Name of Function(Arguments)
public and static are both modifiers so their order does not effect the function signature 
 
 

 
 
 

Monday 21 July 2014

Features of Java: Java Pure Object Oriented or not????

Continuing Features of Java....

Object Oriented :                                    Many People argue that java is a pure object oriented language.But this is not true at all.Java is a object oriented language But not purely Object oriented language.
In Java,if you write any function even main() without enclosed in a class ,you cannot run the program.So it follows that it follows class structure. 
Java is not having direct support for multiple inheritance.That means you cannot have more than one parent class for child class. 
Contradiction:
Through interfaces you can have multiple inheritance .Then how one can say it is not a pure OOPs language??
Java supports primitive data types which means you can declare a variable like this.
                                   int $_a=10;
Contradiction
Here you are not creating an object of class integer But still you are accessing value .If this was possible only through wrapper classes we may call this as pure OOPs language.

Integer i1=new Integer(100);
so here you are creating Object for accessing integer value.
Java does not support pointers
Contradiction:
But Java Implicitly uses pointers only .Just like in ResultSet interface ,pointer is internally pointing to 0 th row then through next() method we use pointer too fetch the data.

Question:  So java is purely Object Oriented or Not????




                                      

Wednesday 16 July 2014

Java : Basics of Java


In computer world,one of the  technology that is considered to be evergreen is JAVA.Java is not a acronym.James Gosling and His team named this language as Oak.But at that time, Oak name was already registered.So they renamed it to Java (which is state that is famous for its coffee,Also the symbol of java a coffee cup)
Application of Java
                                              Java is used in several fields of our day to day life.If you see AC in room,the chip is coded in java only. Similarly,there are so many applications of java out of which  few are as follows:
Desktop Applications
                       Games: one can develop games with the help of java that will be running on windows or any other OS as java is platform independent.
                       Image Processing:Also through java ,one can do image processing in java .Image processing is like converting an image into black n white or textured .
Web Applications
                       Advance Java :  
                                                      JSEE(earlier called J2SE, 2 was a version number as versions  keep on changing so now S is used  )Java Standard Enterprise Edition is useful in making highly secured web Applications.Now a days jdk version 8 is going on.
  
Features of Java
                              Java is having many silent features many of them are listed below.
Secure 
                    Java is highly secure language.How one can say a language is secure.In java ,when you write your code ,you write  a text file and save it with .java extension .Now when the javac compiles compiles the file it is converted into .class file which is a binary file which is not understandable.So that bytecode is distributed to client ,not the original code .For running this bytecode ,client machine must jre installed and then they can run it but cant modify this as they have no access to the code .
In this way java provides security.

Question :There is cavaj software available in the market that can convert .class file into .java .So you will have the original code .So how one can say Java is Secure???????????