Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class p3 extends Thread
- {
- static String str_no;
- static public void set_no(String n)
- {
- str_no=n;
- }
- public void run()
- {
- char ch[]=str_no.toCharArray();//convert string to char array
- for(int i=0;i<str_no.length();i++)
- {
- try
- {
- Thread.sleep(1000);
- }
- catch(Exception ex)
- {
- System.out.println(ex);
- }
- System.out.println(ch[i]);
- }
- }
- public static void main(String args[])
- {
- p3 p=new p3();
- if(args.length==0)
- {
- System.out.println("Please enter argument");
- }
- else if(args.length > 1)
- {
- System.out.println("Enter only 1 argument and its number type");
- }
- else
- {
- p3.set_no(args[0]);
- p.start();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment