NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

LAB1😁😁😁😁😁😁😁😁😁😁😁😁😁😁
import java.io.*;
class gps
{
public static void main (String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter the string:");
String S=br.readLine();
System.out.println("enter the index 1:");
int i1=Integer.parseInt(br.readLine());
System.out.println("enter the index 2:");
int i2=Integer.parseInt(br.readLine());
String str=S.substring(i1,i2);
System.out.println("result is ="+str);
}
}
LAB2😁😁😁😁😁😁😁😁😁😁😁😁😁😁😁
import java.io.*;
class student
{
int rno;
String name="honey";
void getno(int n)
{
rno=n;
}
void Putrno()
{
System.out.println("Rno:"+rno);
System.out.println("Name:"+name);
}
}
class test extends student
{
int mark1,mark2;
void getmarks(int m1,int m2)
{
mark1=m1;
mark2=m2;
}
public void Putmarks()
{
System.out.println("Mark1:"+mark1);
System.out.println("Mark2:"+mark2);
}
}
interface Sports
{
int Sportsmark=75;
void Putmarks();
}
class result extends test implements Sports
{
int total;
public void putmarks()
{
System.out.println("Sportmark="+Sportsmark);
}
void display()
{
total=mark1+mark2+Sportsmark;
Putrno();
Putmarks();
Putmarks();
System.out.println("Total marks:"+total);
}
}
class lab2
{
public static void main (String args[])
{
result Stud = new result();
Stud.getno(1000);
Stud.getmarks(75,100);
Stud.display();
}
}
LAB3😁😁😁😆😆😆😅😅😁😁😄
import java.io.*;
import java.lang.*;
class lab3
{
public static void main(String args[])throws IOException
{
int payamt;
DataInputStream in=new DataInputStream(System.in);
System.out.println("nnpay out of bound exception");
System.out.println("* * *");
System.out.println("n enter a basic pay amount");
payamt =Integer.parseInt(in.readLine());
try
{
if(payamt>1000)
throw new payoutofBoundException("Basic pay is out of bound");
else
System.out.println("n given basic pay is:"+payamt);
}
catch(Exception e)
{
System.out.println("caught:"+e);
}
}
}
class payoutofBoundException extends IOException
{
//String s;
payoutofBoundException(String message)
{
// s=message;
System.out.println(message);
}
}
LAB4😂😂😆😆😅😅😁😁😁😁😁😅😆😆
import java.io.*;
class Table5 extends Thread
{
public void run()
{
for (int i=1;i<=5;i++)
{
System.out.println(i+"*5="+(i*5));
if(i==3) stop();
}
System.out.println("EXIT FIVE");
}
}

class Table7 extends Thread
{
public void run()
{
for (int j=1;j<=5;j++)
{
System.out.println(j+"*7="+(j*7));
try
{
sleep(1000);
}
catch(Exception e) { }

}
System.out.println("EXIT SEVEN");
}
}

class Table13 extends Thread
{
public void run()
{
for (int k=1;k<=5;k++)
{
System.out.println(k+"*13="+(k*13));
}
System.out.println("EXIT THIRTEEN");
}
}

class Lab4
{
public static void main(String args[])
{
Table5 t5=new Table5();
Table7 t7=new Table7();
Table13 t13=new Table13();
t5.setPriority(1);
t7.setPriority(5);
t13.setPriority(10);
System.out.println("MULTI THREADED USING PRIORITY");
t5.start();
t7.start();
t13.start();
}
}
LAB 5😄😄😁😁😅😆😆😆😂😂😂😂😅😁
import java.awt.*;
import java.applet.*;
public class shapes extends Applet
{
public void paint(Graphics g)
{
g.drawRect(10,10,60,50);
g.fillRect(10,10,60,50);
g.drawRoundRect(190,10,60,50,15,15);
g.fillRoundRect(70,90,140,100,30,40);
g.drawLine(0,0,100,100);
g.drawOval(10,10,50,50);
g.fillOval(70,90,140,100);
}
}
/*<applet code="shapes"width=300 height=200>
</applet>*/
LAB6😆😂😆😆😅😅😁😄😅😆😂😂
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Lab06 extends Frame implements ActionListener
{
TextField tname,tstreet,tcity,tpin;
Label lname,lstreet,lcity,lpin;
Button b1;
public Lab06()
{
setBackground(Color.gray);
setForeground(Color.red);
FlowLayout f=new FlowLayout();
setLayout(f);

lname=new Label("NAME ");
lstreet=new Label("STREET");
lcity=new Label("CITY ");
lpin=new Label("PINCODE");
tname=new TextField(35);
tstreet=new TextField(35);
tcity=new TextField(35);
tpin=new TextField(35);
b1=new Button("click me");

add(lname);
add(tname);
add(lstreet);
add(tstreet);
add(lcity);
add(tcity);
add(lpin);
add(tpin);
add(b1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b1)
{
tname.setText("RABIR");
tstreet.setText("75,JEEVA NAGAR");
tcity.setText("OOTY");
tpin.setText("641017");
}
}
public boolean handleEvent(Event e)
{
if(e.id==Event.WINDOW_DESTROY)
System.exit(0);
return(super.handleEvent(e));
}
public static void main(String args[])
{
Lab06 a=new Lab06();
a.resize(380,300);
a.show();
}
}
LAB 7😄😄😁😅😅😅😂😅😂😁
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class Prac7 extends Applet implements ActionListener
{
List list1;
TextField Text1;
Button butt;
public void init()
{
Text1=new TextField(40);
add(Text1);
list1=new List(0,true);
list1.add("C");
list1.add("COBOL");
list1.add("C++");
list1.add("JAVA");
list1.add("Oracle");
list1.add("Visual Basic");
list1.add("Visual C++");
list1.add("Adobe");
add(list1);
butt=new Button("Show Selection ");
butt.addActionListener(this);
add(butt);
}
String Selections[];
public void actionPerformed(ActionEvent e)
{
String outstring=new String("you selected");
if(e.getSource()==butt)
{
Text1.setText("");

Selections=list1.getSelectedItems();
for(int loopIndex=0;loopIndex<Selections.length;loopIndex++)
{
outstring+=" "+Selections[loopIndex];
}
Text1.setText(outstring);
}
}
}
/* <applet code =Prac7.class width=400 height=400>
</applet> */
LAB 8😄😁😅😆😆😆😆😂😂😂😂😂😜😜
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class TextArea1 extends JFrame implements ActionListener
{
JTextField t1,t2,t3,t4;
JTextArea txt;
JLabel l1,l2,l3,l4;
JButton b1;

public TextArea1()
{
JPanel jp=(JPanel)getContentPane();
jp.setLayout(new FlowLayout(1));
l1=new JLabel("NAME=");
jp.add(l1);
t1= new JTextField(10);
jp.add(t1);
l2=new JLabel("AGE=");
jp.add(l2);
t2=new JTextField(2);
jp.add(t2);
l3=new JLabel("QUALIFICATION=");
jp.add(l3);
t3=new JTextField(6);
jp.add(t3);
l4=new JLabel("ADDRESS=");
jp.add(l4);
txt=new JTextArea(",",10,20);
jp.add(txt);
b1=new JButton("clear");
b1.setBackground(Color.red);
jp.add(b1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
try
{
if(e.getSource()==b1)
{
t1.setText(" ");
t2.setText(" ");
t3.setText(" ");
txt.setText(" ");
}
}
catch(Exception ex){}


}
public static void main(String args[])
{
TextArea1 a=new TextArea1();
a.setVisible(true);
a.setSize(300,200);
}
}
LAB 9😅😅😂😂😀😀😀😃😄😄😁😁😄😄
import java.awt.*;
public class MenuDemo extends Frame
{
MenuBar my=new MenuBar();
public MenuDemo()
{
setTitle("MenuBar");
FlowLayout F=new FlowLayout();
setLayout(F);
setMenuBar(my);
Menu fm=new Menu("File");
my.add(fm);
fm.add(new MenuItem("new"));
fm.add(new MenuItem("open"));
fm.add(new MenuItem("save"));
fm.add(new MenuItem("save as"));
fm.add(new MenuItem("Exit"));
Menu em=new Menu("Edit");
my.add(em);
em.add(new MenuItem("undo"));
em.add(new MenuItem("redo"));
em.add(new MenuItem("cut"));
em.add(new MenuItem("copy"));
em.add(new MenuItem("paste"));
em.add(new MenuItem("delete"));
em.add(new MenuItem("select"));
em.add(new MenuItem("select all"));
}
public boolean handleEvent(Event e)
{
if(e.id==Event.WINDOW_DESTROY)
System.exit(0);
return(super.handleEvent(e));
}
public static void main(String args[])
{
MenuDemo m=new MenuDemo();
m.resize(500,500);
m.show();
}
}
LAB10 😆😃😅😂😃😂😃😂😃🤣😀🤣😀🤣😀
LAB 11😀😂😀😅😅😀😅😀😅😀😅😀😅😀
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class DrawShapes extends Applet implements MouseListener
{
int x,y,ch;
public void init()
{
addMouseListener(this);
ch=1;
}
public void paint(Graphics g)
{
switch(ch)
{
case 1:
g.drawOval(x,y,50,50);
break;
case 2:
g.drawRect(x,y,60,50);
break;
case 3:
g.drawOval(x,y,140,100);
}
ch++;
if(ch==4)
{
ch=1;
}
showStatus(x+","+y);
}
public void mouseClicked(MouseEvent me)
{
x=me.getX();
y=me.getY();
repaint();
}
public void mouseEntered(MouseEvent me)
{
x=me.getX();
y=me.getY();
repaint();
}
public void mouseExited(MouseEvent me){}
public void mousePressed(MouseEvent me){}
public void mouseReleased(MouseEvent me){}}
/*<applet code="DrawShapes.class" width=350 height=350>
</applet>*/
LAB 12😀😂🤣😅🤣😅😀😅😀😀😆😀😆
import java.io.*;
import java.util.Scanner;
class AppFile
{
public static void main(String args[])
{
try
{
Scanner sc = new Scanner(System.in);
String s;
RandomAccessFile f=new RandomAccessFile("content.txt","rw");
f.seek(f.length());
System.out.println("Enter a String to append into the file");
s = sc.next();
f.writeBytes(s);
f.close();
}
catch(IOException ioe)
{
System.out.println(ioe);
}
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.