Java R20

3


Java


Java Material

Java Assignment

Unit 1 assignment Click this link

Unit 2 assignment  Click this link  

Unit 3 assignment Click this link

Unit 4 assignment  Click this link  

Unit 5 assignment Click this link





Java Mid 1 important Short Answers

                                         


Post a Comment

3 Comments
  1. package programs;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class ActionListenerEx extends Frame implements ActionListener {
    Label L1,l2,lsp;
    TextField t1;
    Button b1;
    ActionListenerEx()
    {
    super("Action Listener Example");
    setSize(200,200);
    setVisible(true);
    setLayout(new FlowLayout());
    setBackground(Color.cyan);
    L1 = new Label("E nter a number");
    t1 = new TextField(10);
    lsp = new Label("");
    l2 = new Label ("Factorial value is:");
    b1 = new Button("Factorial");
    add (L1);
    add (t1);
    add (b1);
    b1.addActionListener(this);
    }
    public void ActionPerformed(ActionEvent e)
    {
    String s = t1.getText();
    int n = Integer.parseInt(s);
    int f = 1;
    for(int i=1; i<=n; i++)
    f = f*i;
    l2.setText ("Factorial of"+s+"is"+f);
    }
    public static void main(String[]args)
    {
    new ActionListenerEx();
    }
    }

    ReplyDelete
Post a Comment
To Top