Friday, December 24, 2010

import java.util.*;

public class OddEvenThread{
 
 public static void main(String []str){
 
  long no; 
  System.out.println("Enter a no:");
  Scanner sc = new Scanner(System.in);
  no = sc.nextLong();
  OddEven oe = new OddEven(no);
 }
 
}

class OddEven implements Runnable{
 private Thread t=null;
 private long _no;
 
 long getNo(){
  return this._no;
 }
 
 OddEven(long no){
  t = new Thread(this);
  this._no=no;
  t.start();
 }
 
 public void run(){
  if(_no%2==0){
   System.out.println("No is Even");
  }
  else{
   System.out.println("No is Odd");
  }
 }
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.