Skip to main content

Posts

Assignment No:3

//Assignment No:3 Set A  a) Create a PROJECT table with fields project_id, Project_name, Project_description, Project_Status. etc. Insert values in the table. Display all the details of the PROJECT table in a tabular format on the screen.(using swing).  CODE 👇 package project; import java.sql.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; class Project extends JFrame implements ActionListener {                       JLabel l1,l2,l3,l4;             JTextField t1,t2,t3,t4;             JButton b1,b2,b3;             String sql;             JPanel p,p1;             Connection con;             PreparedStatement ps;             JTable t;           ...

Assignment No:2

//Assignment No:2 Set A  a) Program to define a thread for printing text on output screen for ‘n’ number of times. Create 3 threads and run them. Pass the text ‘n’ parameters to the thread constructor. Example:  i. First thread prints “COVID19” 10 times.  ii. Second thread prints “LOCKDOWN2020” 20 times  iii. Third thread prints “VACCINATED2021” 30 times CODE 👇 import java.util.*; class Mythread extends Thread { String msg; int n; Mythread(String m,int a)  {   msg=m;   n=a;   }   public void run()    {      for(int i=0; i<n; i++)       System.out.println(msg+ " "+i);      }    } public class disease  {    public static void main(String[] args)    {   Mythread m1=new Mythread("COVID19",10) ;       Mythread m2=new Mythread("LOCKDOWN2020",20) ;       Mythread m3=new Mythread("VACCINATED2021",30) ;  ...

Assignment No:1

 //Assignment No:1 Set A   a) Write a java program to accept names of ‘n’ cities, insert same into array list collection and display the contents of same array list, also remove all these elements. CODE 👇 import java.util.*; public class city { public static void main(String args[]) { Scanner sc = new Scanner(System.in); ArrayList<String> al = new  ArrayList<String>(); String c; System.out.println("How Many City..?"); int n = sc.nextInt(); for(int i=0; i<n; i++) { System.out.println("Enter City Name"); c = sc.next(); al.add(c); } System.out.println("Citys are"+al); al.clear(); if(al.isEmpty() == true) System.out.println("Arraylist is empty"); else System.out.println("Arraylist is not empty"); } } b) Write a java program to read ‘n’ names of your friends, store it into linked list, also display contents of the same. CODE 👇 import java.util.*; public class ...