* PROGRAM:-1 *
 /*WAP to generates Fibonacci series using
recursion.*/
class febo
{
      int  feb(int n)
      {
                  int
fe;
                  if
(n==1 || n==0) 
                  {
                              return
0;
                  }
                  else
if(n==2)
                  {
                              return
1;
                  }
                  else
                  {
                              return
(feb(n-1)+feb(n-2));
                  }
      }
}
class Febonaci
{
      public
static void main(String args[])
      {
                  int
n,i=1;
                  n=Integer.parseInt(args[0]);
                  febo
f=new febo();
                  while(i<=n)
                  {          
                              i++;
                              System.out.println(f.feb(i));
                  }
      }
}
* PROGRAM:-2 *
/* The class  jetplane declares one abstract method named
numengines(). Therefore, the class it self must also be declared abstract there
are at a two concrete sub classes named DC* and CD10. Each of these provides different
implementation of the numEngines() method. The main() method instantiates. Each
of this classes and invokes its numEngines() method  .*/
import java.io.*;
abstract class jetplane
{
      abstract
void numEngines();
}
class dc extends jetplane
{
      public
void numEngines(int aa,int bb)
      {
                  int
a,b,add;                  
                  a=aa;
                  b=bb;
                  add=a+b;
                  System.out.println("addition
is:"+add);
      }
} 
class CD10 extends jetplane
{
      public
void numEngines(int aa,int bb)
      {
                  int
a,b,sub;                   
                  a=aa;
                  b=bb;
                  sub=a-b;
                  System.out.println("substraction
is:"+sub);
      }
}
class call1
{
public static void main(String args[])
      {
                  dc
o1=new dc();
                  o1.numEngines(100,200);
                  CD10
o2=new CD10();
                  o2.numEngines(200,100);       
      }
}
* PROGRAM:-3 *
/*Write
a java program that illustrates interface inheritence. Interface P is extended
by P1 and P2. Interface P12 inherits from both P1 and P2. Each interface
declares one constants and one method. Class Q implements P12. Instantiate Q
and invoke each if its method. Each method display one of the constant.*/
import java.io.*;
interface P
{
      int
p=0;
      void
fp();
}
interface P1 extends P
{
      int
p1=1;
      void
fp1();
}
interface P2 extends P
{
      int
p2=2;
      void
fp2();
}
interface P12 extends P1,P2
{
      int
p12=12;
      void
fp12();
}
class Q implements P12
{
      public
void fp()
      {
                  System.out.println("fp:  "+p);
      }
      public
void fp1()
      {
                  System.out.println("fp1:  "+p1);
      }
      public
void fp2()
      {
System.out.println("fp2:  "+p2);
}
      public
void fp12()
      {
                  System.out.println("fp12:  "+p12);
      }
}
class Prog16
{
      public
static void main(String args[])
      {
                  Q
q=new Q();
                  q.fp();
                  q.fp1();
                  q.fp2();
                  q.fp12();
      }
}
* PROGRAM:-4 *
/*WAP
that illustrates how a method can invoke a super class method. class2 is
extended by J2. class j2 extended by k2. each of these classes define a
“getdetail()” that return a string. That string includes a description of a
class + description of each super class.instantiate each of these classes and
invoked the getdetail().  */
imports java.io.*;
class k2
{
      String
str=new String("k2 define");
      String
dispk2()
      {
                  return
str;
      }
}
class j2 extends k2
{
      String
str1=new String("j2 define");
      String
display()
      {
                  System.out.println(super.display());
                  return
str1;
           }
}
class I2 extends j2
{
      String
str2=new String("I2 define");
      String
display()
      {
                  System.out.println(super.display());    
                  return
str2;
      }
}
class TestSuper
{
      public
static void main(String args[])
      {
                  I2
obj=new I2();
                  String
s1;
s1=obj.dispj2();
                  System.out.println(s);
      }
}
* PROGRAM:-5 *
/*Write
a java code to create package called “stud ” in which create a class “student ”
which contain the information rollno and name of students. Create another
package “marks” in which create a class “studentmarks” which is extends from
“student” and it contain instance variable say marks of 3 subjects. Write a
java code to store main() in different package and required argument through
command line.*/
package stud;
public class student extends
marks.studmarks
{
 
int n;
 
String na;
 
public stud(int roll_no,String name)
   
{
     
n=roll_no;
     
na=name;
   
}
 
public void display()
      
{
               p2.result r=new p2.result();
             
System.out.println("roll_no="+n);
             
System.out.println("name="+na);
             
System.out.println("unix="+r.m1);
             
System.out.println("os="+r.m2);
             
System.out.println("java=”+r.m3);
      
}
}
package stud;
  
class demo
  
{
 public static void main(String a[])
 {
           int no;
           String nam;
           System.out.println("enter the
no");
           no=Integer.parseInt(args[0]);
           System.out.println("enter the
name");
           nam=args[1];
  
       stud s1= new stud(no,nam);
         
s1.display();
        
}
  
}
package marks;
public class studmarks
  
{
     
public int m1=34;
     
public int m2=35;
     
public int m3=36;
 }
* PROGRAM:-6*
/*Write
a programm to perform search operator(make user of package and buffer class) */
import java.io.*
class Stringchk
   {
public static void
main(String args[])throws IOException
 {
BufferedReader
br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter
a string : ");
String
s=br.readLine();
String s1=s;
int i,l=s.length();
boolean res;
char array1[]=new
char[l];
char array2[]=new
char[l];
for(i=0;i<l;i++)
   {
array1[i]=s.charAt(i);
array2[l-i-1]=s.charAt(i);
   }
System.out.println("Printing
array2 which is reverse of array 1 : ");
for(i=0;i<l;i++)
System.out.print(array2[i]+"
");
res=isPalindrome(array1,array2);
System.out.println("\nThe
string entered by user is a palindrome : "+res);
for(i=0;i<l;i++)
s1+=array2[i];
System.out.println("\nThe
new string which has the original string and reversed )
    }
     static boolean isPalindrome(char a[],char
b[])
        {
int
i,fl=0,l=a.length;
for(i=0;i<l;i++)
                   {
return true;
else
return false;
                }
}
* PROGRAM:-7 *
/*Reverse
each word in string and count total word */
import java.applet.*;
import java.awt.event.*;
import java.awt.*;
/* <applet code=reverse width=300 height=200 >
   </applet>
*/
public class reverse extends Applet implements ActionListener 
{
            int i,l;
            TextField t1;
            String s1;
            String msg="
";
            Button b1;
            public void init()
            {
                        t1 = new
TextField(5);
                        b1 = new
Button("Reverse");
                        add(t1);
                        add(b1);
                        b1.addActionListener(this);
            }
            public void
actionPerformed(ActionEvent e)
            {
                        s1=t1.getText();
                        l=s1.length();
                        msg=msg+s1.charAt(l-1);
                        while(l>=0)
                        {
                                    l=l-1;
                                    msg=msg+s1.charAt(l-1);
                                           
repaint();
                        }
            }
            public void paint(Graphics
g)
            {
                        g.drawString("Reverse
String Is : "+msg,80,120);
            }
}
* PROGRAM:-8 *
/*Write a Java code to input ten
different names and arrange them in alphabetical order.*/
import java.io.*;
class Sortstring
{
      public
static void main(String args[])
      {
String arr[]= {"Amisha","Pratik","Binal","Jinal",
"Ravi","Keyur","Sneha","Niki","Radhi","Bhakti"};
                  System.out.println("Before
Sorting:");
                  for(int
i=0;i<10;i++)
                  {
                              System.out.println(arr[i]);
                  }
                  for(int
i=0;i<10;i++)
                  {
                              for(int
j=i+1;j<10;j++)
                              {
                                          if(arr[i].compareTo(arr[j])>0)
                                          {
                                                      String
temp=arr[i];
                                                      arr[i]=arr[j];
                                                      arr[j]=temp;
                                          }
                              }
                  }
                  System.out.println("After
Sorting:");
                  for(int
i=0;i<10;i++)
                  {                                                                                  
                              System.out.println(arr[i]);
                  }
      }
}
* PROGRAM:-9 *
/*Write
a java code to receive line of text and count the frequency of each of every
character */
import java.io.*;
class efreq
{
                        public
static void main(String args[])throws IOException
                        {
                        BufferedReader
br=new BufferedReader(new InputStreamReader(System.in));
                                    System.out.print("Enter
any string: ");
                        String
s = br.readLine();
                        s=s.toLowerCase();
                        int
l=s.length();
                                    char
ch;
                                    System.out.println("Output:");
                                    System.out.println("==========================");
                                    System.out.println("Alphabet\tFrequency");
                                    System.out.println("==========================");
                        int
count=0;
                        for(char
i='a'; i<='z'; i++)
                        {
                        count
= 0;
                        for(int
j=0; j<l; j++)
                        {
                        ch=s.charAt(j);
                        if(ch==i)
                        count++;
                        }
                        if(count!=0)
                        {
                        System.out.println(i+"\t\t"+count);
                        }
            }
}
}
* PROGRAM:-10 *
/*Write
a java  code to input line of text delete
all the occurrences of input character by user output should be without holes*/
import java.io.*;
class pro10
{
    
public static void main(String[] args)
           
throws IOException
           
{
               
String str1;
               
BufferedReader input = new BufferedReader(new
InputStreamReader(System.in));
               
System.out.print("Enter String : ");
               
str1=input.readLine();
               
System.out.println("the inputed String is  : 
"+str1);
            System.out.println("the
input a charcter to be delete in entered String : ");
            char
a=input.readLine().charAt(0);
                                       int len=str1.length();
                                       System.out.println("Length :
"+len);
                                                for(int
i=0;i<len;i++)
                                                {
                                                                        char
c=str1.charAt(i);
                                                                        if(c==a)
                                                                        {
                                                                                    String
front=str1.substring(0,i);
                                                                                    String
back=str1.substring(i+1);
                                                                                    str1=front+back;
                                }
 
System.out.println("Output : 
"+str1);
            
}
}
* PROGRAM:-11 *
   /*Write a java code to input line of text and
replace all the occurences of inputted            character by replacing character.
Example:
coconut 
Character
to be replace: c
Replace
with: t
O/p:
totonut*/
import java.util.*;
class replacechar
{
      public
static void main(String args[])
      {
                  Scanner
sc=new Scanner(System.in);
                  String
str,str1,str2;
                  System.out.println("enter
string:-");
                  str=sc.nextLine();
                  System.out.println("enter
character you want to replace it:-");
                  str1=sc.nextLine();
                  System.out.println("enter
character you want to change it:-");
                  str2=sc.nextLine();
                  System.out.println("origional
string=" +str);
                  str=str.replace(str1,str2);
                  System.out.println("Replace
string:-" +str);
      }
}          
* PROGRAM:-12 *
/*Write a programm which accept
first,last,middle name from command line argument and perform follow
operation*/
-Find
the length of each name
-Print
intilize 
-Count
Total Number of Vowels
-Replace
Vowels with '$' sign
-Reverce
First name
-Find
the length of each name :
class nlength
{
            public
static void main(String args[])
            {
                        String
s=args[0];
            System.out.println("string
is:"+s);
            System.out.println("length
of string is:"+s.length());
            }
}
-Print
intilize :
import java.util.*;
class pint1
{
            public
static void main(String args[])
            {
            Scanner
in=new Scanner(System.in);
            String
s;
            int
c=0,cc=0;
            System.out.print("enter
string:");
            s=in.nextLine();
            for(int
i=0;i<s.length();i++)
            {
                        if(s.charAt(i)==32)
                        {
                                    c++;
                        }
            }
for(int i=0;i<s.length();i++)
{
                        if(s.charAt(i)==32)
                        {
                                    cc++;
                                    System.out.print("
");
                                    if(c==cc)
                                    {
                                                System.out.print(s.charAt(i+1)+".");
                                                break;
                                    }
                                    else
                                    {
                                                System.out.print(s.charAt(i));
                                    }          
                        }
                    }
            
}
}
-Count
Total Number of Vowels:
import java.util.*;
class nvowel
{
            public
static void main(String args[])
            {
                        Scanner
in=new Scanner(System.in);
                        String
s;
                        int
c=0;
                        System.out.print("Enter
string");
                        s=in.nextLine();
                                    for(int
i=0;i<s.length();i++)
                                    {
                                    if(s.charAt(i)=='a'
|| s.charAt(i)=='A' || s.charAt(i)=='e' || s.charAt(i)=='E' || s.charAt(i)=='i'
|| s.charAt(i)=='I' || s.charAt(i)=='o' || s.charAt(i)=='O' || s.charAt(i)=='u'
|| s.charAt(i)=='U')
                                    {
                                                c=c+1;
   System.out.print(s.charAt(i));
                                    }
                        }
                        System.out.println("total
vowels are:"+c);
        }
}
-Replace
Vowels with '$' sign:
import java.io.*;
class RemoveVowels
{
    
public static void main(String[] args)
           
throws IOException
           
{
               
String str1;              
               
BufferedReader input = new BufferedReader(new
InputStreamReader(System.in));
               
System.out.print("Enter String : ");
               
str1=input.readLine();
               
System.out.println("the inputed String is  : 
"+str1);
                                       int len=str1.length();
                                       System.out.println("Length :
"+len);
                                                for(int
i=0;i<len-1;i++)
                                                {
                                                                        char
c=str1.charAt(i);
                                                                        if(c=='a'
|| c=='A' || c=='e' || c=='E' || c=='i' || c=='I' || c=='o' || c=='O' || c=='u'
|| c=='U')
                                                                        {
                                                                                    String
front=str1.substring(0,i);
                                                                                    String
back=str1.substring(i+1);
                                                                                    str1=front+"$"+back;
                                                                        }
                                                }
                                                  System.out.println("Output :  "+str1);
            
}
}
-Reverce
First name:
import java.util.*;
class Reverse
{
            public
static void main(String args[])
            {
                        Scanner
in=new Scanner(System.in);
                        String
a,b=" ";
                        System.out.print("Enter
name:");
                        a=in.nextLine();
                        int
len=a.length();
                        for(int
i=len-1;i>=0;i--)
                        {
                                    b=b+a.charAt(i);
                        }
                        System.out.println("Reverse
String is  :  "+b);
            }
}
* PROGRAM:-13 *
/*Create
a multi thread using single class */
    class NewThread implements Runnable 
    {
String name; 
Thread t;
NewThread(String threadname) 
{
name = 
threadname;
t = new Thread(this, name);
System.out.println("New thread: " + t);
t.start(); // Start the thread
}
public void run() 
 {
try 
  {
for(int i = 5; i > 0; i--) 
{
 
System.out.println(name + ": " + i);
 
Thread.sleep(1000);
}
   } 
catch (InterruptedException e) 
 {
System.out.println(name +
"Interrupted");
 }
   System.out.println(name + "
exiting.");
 
}
}
class MultiThreadDemo 
 {
public static void main(String
args[])
 {
   new NewThread("One"); // start
threads
   new NewThread("Two");
   new NewThread("Three");
 try 
 
{
 
Thread.sleep(10000);
 } 
 
catch (InterruptedException e) 
       {
    System.out.println("Main thread
Interrupted");
    }
System.out.println("Main
thread exiting.");
    }
* PROGRAM:-14*
/*Write
a application that execute to thread once thread display A even one second and
other display B every three second,Create the thread executing in the thread
class*/
class A extends
Thread
{
      public void run()
      {
                  System.out.println("thread
A started");
                  for(int i=1;i<=5;i++)
                  {
                              System.out.println("i="+i);
                  }
                  System.out.println("exit
A");
      }
}
class B extends
Thread
{
      public void run()
      {
                  System.out.println("thread
B started");
                  for(int j=1;j<=5;j++)
                  {
                              System.out.println("j="+j);
                  }
                  System.out.println("exit
B");
      }
}
class C extends
Thread
{
      public void run()
      {
                  System.out.println("thread
C started");
                  for(int k=1;k<=5;k++)
                  {
                              System.out.println("k="+k);
                  }
                  System.out.println("exit
C");
}
}
class ThreadPri
{
      public static void main(String args[])
      {
                  A obj1=new A();
                  B obj2=new B();
                  C obj3=new C();
                  obj3.setPriority(Thread.MAX_PRIORITY);
                  obj2.setPriority(obj1.getPriority()+1);
                  obj1.setPriority(Thread.MIN_PRIORITY);
                  obj1.start();
                  obj2.start();
                  obj3.start();
      }
}
* PROGRAM:-15 *
/*An
example of Thread priority.*/
class A extends Thread
{
      public
void run()
      {
                  System.out.println("thread
A started");
                  for(int
i=1;i<=5;i++)
                  {
                              System.out.println("i="+i);
                  }
                  System.out.println("exit
A");
      }
}
class B extends Thread
{
      public
void run()
      {
                  System.out.println("thread
B started");
                  for(int
j=1;j<=5;j++)
                  {
                              System.out.println("j="+j);
                  }
                  System.out.println("exit
B");
      }
}
class C extends Thread
{
      public
void run()
      {
                  System.out.println("thread
C started");
                  for(int
k=1;k<=5;k++)
                  {
                              System.out.println("k="+k);
                  }
                  System.out.println("exit
C");
      }
}
class ThreadPri
{
      public
static void main(String args[])
      {
                  A
obj1=new A();
                  B
obj2=new B();
                  C
obj3=new C();
                  obj3.setPriority(Thread.MAX_PRIORITY);
                  obj2.setPriority(obj1.getPriority()+1);
                  obj1.setPriority(Thread.MIN_PRIORITY);
                  obj1.start();
                  obj2.start();
                  obj3.start();
      }
}
* PROGRAM:-16 *
 /*Write a java code to implement stack application using thread*/
import java.io.*;
class stack{
  int
stack[]=new int[10];
            int tos;
            stack()
            void push(int item)
            
{
                        if(tos==9)
                           {
                               System.out.println("stack is
full");
                             }
                         else
                             {
                                 stack[++tos]=item                           
            
}
 int
pop()
            {
                        System.out.println("stack
underflow");
                        return
0;
            }
 class
test stack
{
            public static void main(String
args[])
            {
                        stack mystack1=new stack();
                        stack
mystack2=new stack();
                         mystack1.push(i);
              
}
                        for(int
i=10;i<20;i++)  {
                         mystack2.push(i);
               
}
                        System.out.println("stack
in my stack1:");
             
          for(int i=0;i<10;i++)
{
                        System.out.println(mystack1.pop());
              
}
                        System.out.println("stack
in my stack2:");
                        for(int
i=0;i<10;i++)
               
{
             
                      System.out.println(mystack2.pop());
}
* PROGRAM:-17 *
/*An
example of deadlock.*/
class A
{
      B
b;
      synchronized
void a1()
      {
                  System.out.println("string
a1");
                  b.b2();
      }
      synchronized
void a2()
      {
                  System.out.println("string
a2");
      }
}
class B
{
      A
a;
      synchronized
void b1()
      {
                  System.out.println("string
b1");
                  a.a2();
      }
      synchronized
void b2()
      {
                  System.out.println("string
b2");
      }
}
class Th1 extends Thread
{
      A
a;
      Th1(A
a)
      {
                  this.a=a;
      }
      public
void run()
      {
for(int i=0;i<10;i++)
                  {
                              a.a1();
                  }
      }
}
class Th2 extends Thread
{
      B
b;
      Th2(B
b)
      {
                  this.b=b;
      }
      public
void run()
      {
                  for(int
i=0;i<10;i++)
                  {
                              b.b1();
                  }
      }
}
class Deadlock
{
      public
static void main(String args[])
      {
                  A
a=new A();
                  B
b=new B();
                  a.b=b;
//get lock on a
                  b.a=a;
//get lock on b
                  Th1
t1=new Th1(a);
                  Th2
t2=new Th2(b);
                  t1.start();
                  t2.start();
                  System.out.println("done..........");
      }
}
 *
PROGRAM:-18 *
/*Create Applet which different location with
different colours*/
Public static Color colors[][] =
 {
            mix(250,
220, 100), // normal
            mix(200,
150, 80), // dim
            mix(255,
230, 150) // bright
};
Public static Color mix(int r, int g, int b)[]
{
Color arr[] = new Color[3];
arr[NORMAL] = new Color(r, g, b);
arr[DIM] = gain(arr[0], .71);
arr[BRIGHT] = gain(arr[0], 1.31);
return arr;
}
Public static int clamp(double d)
 {
return (d < 0) ? 0 : ((d > 255) ? 255 :
(int) d);
}
Public static Color gain(Color c, double f) 
{
return new Color(
clamp(c.getRed() * f),
clamp(c.getGreen() * f),
clamp(c.getBlue() * f));
 }
* PROGRAM:-19 *
/*Create
Applet which display text at different location with rectangle. Rectangle        should be inside circle and triangle.*/
/*Java code for applet*/
import java.applet.*;
import java.awt.*;
public class rect extends Applet
{
      public
void paint(Graphics g)
      {
                  g.drawRect(80,150,250,300);
                  g.drawOval(80,150,250,300);
                  int
n=3;
                  int
x[]=new int[n];
                  int
y[]=new int[n];
                  x[0]=200;
                  y[0]=150;
                  x[1]=110;
                  y[1]=380;
                  x[2]=310;
                  y[2]=380;
                  g.drawPolygon(x,y,n);
      }
}
/*HTML code for flower directory.*/
<html>
<head>
</head>
<body>
<applet code="rect.class"
height=100% width=100%>
</applet>
</body>
</html>
* PROGRAM:-20 *
/*Write an applet tag accept multiple parameter that identifiers a set
of image select one of this random at display it */
import Java.awt.*;
import Java.applet.*;
public class DisplayImage extends Applet    
            {
            Textfield
T1,T2;
            public
void init()
                        {
                        img1=getImage(getDocumentBase(),getparameter("Image1"));
                        img2=getImage(getDocumentBase(),getparameter("Image2"));
                        }
            public
void pain(Graphics g)
                        {
                        g.drawImage(img1,0,0,this);
                        g.drawImage(img2,100,100,this);
                        }
            }
Applet
Tag :
<applet code=AppletSub.class
width="500" height="500">
       
<param name="imagesource" value=image1/beans>
       
<param name=" imagesource " value=image2/beans>
       
</applet>
* PROGRAM:-21 *
/*input
two number and find out sum of inputted two number of using applet*/
import Java.awt.*;
import Java.applet.*;
public class Sumof2no extends Applet    
            {
            Textfield
T1,T2;
            public
void init()
                        {
                                    T1
= new textfield(10);
                                    T2
= new textfield(10);
                                    add(T1);
                                    add(T2);
                                    T1.setText("0");
                                    T2.setText("0");
                        }
                        public
void pain(Graphics g)
                        {
                                    int
a,b,result;
                                    sring
str;
                                    g.drawString("enter
num in textfield to find assition of 2 no",10,50);
                                    g.setColor(color.red);
                                    str=T1.getText();
                                    a=Integer.parseInt(str);
                                    str=T1.getText();
                                    b=Integer.parseInt(str);
                                    result=a+b;
                                    g.drawString("addition
the result is :"+result,10,80);
                                    Showstatus("addition
of 2 numbers");
                        }
                        public
boolen action(enent e,object o)
                        {
                                    repaint();
                                    return
true;
                        }
* PROGRAM:-22 *
/*An
example of drawing different different object in applet*/
import Java.awt.*;
import Java.applet.*;
public class Linerect extends Applet    
            {
                        public
void pain(Graphics g)
                        {
                        g.drawLine(10,10,50,50);
                        g.drawRect(10,60,40,30);
                        g.setColor(Color.blue);
                        g.fillRect(60,10,30,80);
                        g.setColor(Color.green);
                        g.drawRoundRect(10,100,80,50,10,10);
                        g.setColor(Color.yellow);
                        g.fillRoundRect(20,110,60,30,5,5);
                        g.setColor(Color.red);
                        g.drawLine(100,10,230,140);
                        g.drawLine(100,140,230,10);
                        g.drawString("Line
Rectangles",65,180);
                        g.drawOval(230,10,200,150);
                        g.setColor(Color.blue);
                        g.fillOval(245,25,100,100);
                        }
            }    
* PROGRAM:-23 *
  /*Applet to draw to three triangle
according in Red,Green,Blue */
import
java.awt.*;
import
java.applet.*;
public
class elipse extends Applet
{
             public void paint(Graphics g)
            {          
                        g.drawOval(50,50,80,80);
                        g.drawLine(90,50,50,100);
                        g.drawLine(50,100,130,100);
                        g.drawLine(90,50,130,100);
            }
}
<html>
  <body>
    <applet code="elipse.class"
height="300" width="300">
<para=color
value="Red">
</applet>
<applet
code="elipse.class" height="300" width="300">
<para=color
value="Green">
</applet>
<applet code="elipse.class"
height="300" width="300">
<para=color
value="Blue">
</applet>
  </body>
  </html>
* PROGRAM:-24 *
  /*
Write a programm that genrate custom expression if any of its command line
argument are floating point number */
public class InputFromUser 
{
   
        public static void
main(String args[]) throws IOException 
{
             System.out.println("Please enter input
from command prompt: ");
            Scanner
inputReader = new Scanner(System.in);
String name =
inputReader.nextLine();
                        System.out.println("Hi
" + name);
                        System.out.println("Please
enter a number from command line? ");
                        int
number = inputReader.nextInt();
                        System.out.println("You
have entered : " + number);
                        System.out.println("Please enter a floating point number
from command line? ");
                        float
decimal = inputReader.nextFloat();
                        System.out.println("You
have entered : " + decimal);      
                        String
input = JOptionPane.showInputDialog("Enter any number of your
choice");
                        System.out.println("User
has entered: " + input);
   
        }
            }

Comment Here