About Me

My photo
Raipur, Chhattisgarh, India
Hi , I am Amit Thakur. I have worked as a QA Engineer for two years and as a Java Developer for one year in NIHILENT TECHNOLOGIES PVT. LTD., Pune.Currently I am working as DEAN (Research & Development) in Bhilai Institute of Technology, Raipur.

Thursday, April 7, 2011

Write to me...

My Email Ids are:-
amit_thakur744@yahoo.co.in
amitthakur744@gmail.com

Monday, April 26, 2010

JAVA(Demo of Interface)---------------------

//Interface Example

interface InterfaceDemo

{

public void show();

public int display();

}

class A implements InterfaceDemo

{

public void message(int num)

{

System.out.println("Message method..."+num);

}

public void show()

{

System.out.println("show method...");

}

public int display()

{

System.out.println("display method...");

return(0);

}

}

class InrterfaceExample

{

public static void main(String jj[])

{

A a=new A();

a.message(5);

a.show();

a.display();

}

}
Output:-



JAVA(Demo Of Final class, Method and variable)

//Demo of final class and Methods and Variables

final class A

{

final public void show()

{

final int num=100;

System.out.println("This is Show method of class A...");

num=50;

}

}

class B extends A

{

int num=200;

public void show()

{

System.out.println("This is Show method of class B...");

}

}

class FinalDemo

{

public static void main(String ll[])

{

B b=new B();

b.show();

}

}

Output:-

JAVA(Count the No of Vowels in String)------

//Count the No of Vowels in String


import java.io.*;

class VowelsInString

{

public static void main(String dd[])throws Exception

{

String str;

int count=0;

InputStreamReader isr=new InputStreamReader(System.in);

BufferedReader br=new BufferedReader(isr);

System.out.println("Enter Your String..");

str=br.readLine();

int len=str.length();

for(int i=0;i

{

if(str.charAt(i)=='a' || str.charAt(i)=='e' || str.charAt(i)=='i' || str.charAt(i)=='o' || str.charAt(i)=='u')

{

count++;

}

}

System.out.println("Number of Vowels is "+count);

}

}

JAVA(Reverse The String)------------------------------

//Reverse The String


class ReverseString

{

public static void main(String A[])

{

String str1="amit";

StringBuffer str2=new StringBuffer("");

int len=str1.length();

for(int i=len-1;i>=0;i--)

{

str2.append(str1.charAt(i));

}



System.out.println("Reverse of String is..."+str2);



}

}



// -----------------OR-----------------------------



//public class ReverseString

//{

// public static void main(String[] args)

// {

// String str = "What's going on?";

// System.out.println(ReverseStringTest.reverseIt(str));

// }

//}



//class ReverseStringTest

//{

// public static String reverseIt(String source)

// {

// int i, len = source.length();

// StringBuffer dest = new StringBuffer(len);

//

// for (i = (len - 1); i >= 0; i--)

// {

// dest.append(source.charAt(i));

// }

// return dest.toString();

// }

//}

JAVA(Sorting The Array)-------------------

//Sorting the Array


import java.io.*;

import java.util.*;

class DemoArray

{

public static void main(String aa[])throws Exception

{

int arr[]=new int[10];

DataInputStream dis=new DataInputStream(System.in);

System.out.println("Enter 10 elements in Array..");

for(int i=0;i<10;i++)

{

arr[i]=Integer.parseInt(dis.readLine());

}

System.out.println("Entered 10 elements in Array ....");

for(int i=0;i<10;i++)

{

System.out.print(" "+arr[i]);

}

Arrays.sort(arr);

System.out.println("");

System.out.println("Sorted 10 elements in Array ....");

for(int i=0;i<10;i++)

{

System.out.print(" "+arr[i]);

}





}

}

JAVA(Prime Number)---------------------

//Prime Number


import java.io.*;

class Prime

{

public static void main(String args[])

{





int num=0,flag=0;

System.out.println("Please Enter Your NUmber..");

try

{

DataInputStream dis=new DataInputStream(System.in);

num=Integer.parseInt(dis.readLine());

}

catch(Exception e){}



for(int i=2;i

{

if(num%i==0)

{

flag=1;

break;

}

else

{

flag=0;

}

}



if(flag==0)

{

System.out.println("Number is Prime NUmber..");

}

else

{

System.out.println("Number is Not Prime NUmber..");

}



}

}