Friday 18 May 2012

Android Application Development

TUTORIAL FOR DEVELOPING ANDROID APPLICATION WILL BE DEVELOPED SOON..!

Thursday 15 March 2012

Single Dimensional Array In java:-

Single Dimention Array Definition:
            A list of the items can be given one variable name using only one subscript and such a variable is called one dimensional array.


Syntax:
Type variable_name[size];

Single Dimensional Array simple program :
Create a package emp_pack and a class Employee under that 

package emp_pack;
import output_pack.*;
import details_pack.*;

public class Employee {
      public static void main(String args[])
      {
            Details arr[] = new Details[3];
            arr[0] = new Details (1, "Prem Krishnan","MVC");
            arr[1] = new Details (2, "Parvathy Krishnan", "MMC");
            arr[2] = new Details (3, "Karthick Prabhu", "SEZ");
            new Output().display(arr);
      }
}

Create a package details_pack and a class Details under that 

package details_pack;
public class Details {
      private int id;
      private String name;
      private String address;
      public Details (int num, String name, String addr )
      {
            id = num;
            this.name = name;
            address = addr;  
      }
     
      public String toString()
      {
            return "Id is :" +id + "\nName is: " +name + "\nAddress is: " +address;                  
      }
}

Create a package output_pack and a class Output under that

package output_pack;
import details_pack.*;
public class Output
{          
      public void display(Details array[]){
            for(int i = 0; i < array.length; i++){
                  System.out.println(array[i]);
            }
      }
}

Output:-
Id is :1
Name is: Prem Krishnan
Address is: MVC 
Id is :2
Name is: Parvathy Krishnan
Address is: MMC
Id is :3
Name is: Karthick Prabhu
Address is: SEZ

Explanation 

Array Concept in java

Array Definition:
        Array is an variable that holds multiple values of same data type.

How to get array length in java? 
array length Definition: 
arr.length give the length of the array where arr is the array name.
Syntax:
arrayname.length;


Array simple Program: 
package array_pack;
class arr
{
      private int arr[] = new int[2];
      public void array_init()
      {
      arr[0] = 1;
      arr[1] = 2;
      }
      public void array_print()
      {
      for(int i = 0; i<arr.length; i++)
      System.out.println(arr[i]);
      }
}
public class arr_process {
      public static void main (String args[])
      {
            arr a = new arr();
            a.array_init();
            a.array_print();
      }
}

Output: 
1
2

Explanation: 
           First the program creates the instance for the class arr..Now with the help of the instance we are calling the array_init() function and array_print() function.

Note :
arr.length give the length of the array where arr is the array name.

Tags:
Array Declaration,Array,Array in java,A simple array program,array definition,array concept in java,programs,simple programs,java beginners,array length,

Static Concepts in java

Static Definition:
        In classes, a static method is one that is called without an instance of that class(object), while a non-static method is called by instances of the class(object).  

Static Program: 
package static_pack;
public class stat {
      static int i = 12;
      int j = 20;
      static
      {
            subclass sub = new subclass();
            System.out.println("The Static value is: " +i);
            //System.out.println("The Static value is: " +j);
           
            sub.display();
      }
      public static void main(String[] args)
      {
            System.out.println("Oops Main class after static block...");
            subclass.print();
      }
}
create a subclass class in the same package:

package static_pack;
public class subclass
{
      static void print()
      {
            System.out.println("In Subclass static method");
      }
      public void display()
      {
            System.out.println("Static yaar!!");
      }
}

Output:-
The Static value is: 12
Static yaar!!
Oops Main class after static block...
In Subclass static method

Explanation :
                 From the above program u can understand that Static block gets executed before the public static void main(String args[]). The static block gets executed and then the main block gets executed

Tags:
        Static program in java, Static program with Example, Static concept java, simple Static program,interview static,static program,use of static block,static block,Static function,Static Declaration

Friday 9 March 2012

How To Design A simple Basic Background Design For a WebSite?

HTML Coding:

<html>
<head>
<title>
 Simple WebPage
</title><link rel="stylesheet" href="background.css" type="text/css">
</head>
<body>
<div id="WhitePage">
</div>
</body>
</html>

CSS Coding:
Background.css

body
{
background-color:#E3E1E2;
}
#WhitePage
{
background-color:white;
Width:auto;
height:auto;
align:center;
margin-top:8%;
margin-bottom:8%;
margin-left:8%;
margin-right:8%;
padding-bottom:10cm;
box-shadow:15px 15px 5px #888888;
}

Explanation for css:
              If u need To know about the css coding just change the value alone and see :
For Example 

  • If u change the value of the padding bottom to 100 cm the whitepage which is expaned...
  • If u change the margin-top,bottom,left,right it changes the border...
  • If u change the box-shawdow to 100px 100px 50px #888888; u can feel the difference.
Note :
         Old IE Does not support some css like box shadow.. so use chrome to feel the diference 


Explanation for the Whole Coding:

Here in the link tag style sheet is loded href indicates the path where the file is stored ..now it finds css background.css page ..It automatically subites the back ground color for body and for div tag it subtitutes the  #whitepage which is to be written in div tag like this <div id="whitepage">..

Output:


Tags:
simple Basic Background Design For a WebSite,webdesign a showdow box?,sadowBox,first step for basic design of any website,first step for basic design template




A Simple Hello World Program in Java

To run a simple hello world program in java First we need to write the program in the notepad
as give below:

Step1:
Class Helloworld{
   public static void main(String args[])
   {
System.out.println("Hello World..!");
   }
}

Step2:
Save it with the file name Helloworld.java[The File name must be the name of the class].

Step 3:
Compile the program in command prompt(cmd)javac HelloWorld.java is used to compile the source code
Note:
When u compile the program it will create a byte-code file name Helloworld.class

Step 4:
Run the program in comand Prompt(cmd)
java HelloWorld
Note:
Now the byte code is excected in java interpreter with the command given above

Output of the Program :
Hello World..!

Tags:
          simple java Program,java,class,bycode,interpreter,source code,.java