ittimepass
ittimepass
IT TIME PASS
613 posts
Don't wanna be here? Send us removal request.
ittimepass · 7 years ago
Text
Write a program in java to demonstrate remove duplication from ArrayList to TreeSet?
Write a program in java to demonstrate remove duplication from ArrayList to TreeSet?
Tumblr media
import java.util.*; public class ListAdd {       public static void main(String arg[])       {             Scanner in=new Scanner(System.in);             ArrayList ls=new ArrayList();             TreeSet set=newTreeSet();             ls.add("Vikrant");             ls.add("Manish");             ls.add("Suraj");             ls.add(3,"Amit");             ls.add("Manish");            …
View On WordPress
1 note · View note
ittimepass · 7 years ago
Text
Write a program in java to demonstrate HashSet?
Write a program in java to demonstrate HashSet?
import java.util.*; public class ListHashSet {       public static void main(String arg[])       {             HashSet ListTreeSet=new HashSet();             System.out.println("Adding Kundan First Time "+ListTreeSet.add("Kundan"));             ListTreeSet.add("Suraj");             ListTreeSet.add("Manish");             ListTreeSet.add("Ankit");             System.out.println("Adding…
View On WordPress
0 notes
ittimepass · 7 years ago
Text
Write a program in java to demonstrate TreeSet?
Write a program in java to demonstrate TreeSet?
import java.util.*; public class ListTreeSet {       public static void main(String arg[])       {             TreeSet ListTreeSet=new TreeSet();             System.out.println("Adding Kundan First Time "+ListTreeSet.add("Kundan"));             ListTreeSet.add("Suraj");             ListTreeSet.add("Manish");             ListTreeSet.add("Ankit");             System.out.println("Adding…
View On WordPress
2 notes · View notes
ittimepass · 7 years ago
Text
Write a program in java to demonstrate JDBC?
Write a program in java to demonstrate JDBC?
//    set classpath=C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar //    set path=C:\Program Files (x86)\Java\jdk1.7.0\bin import java.sql.*; class JavaDataBase {       public static void main(String arg[])       {             try             {                   Class.forName("oracle.jdbc.driver.OracleDriver");                   Connection con=DriverManager.getConnect…
View On WordPress
0 notes
ittimepass · 7 years ago
Text
Write a program in java to prevent duplication from list?
Write a program in java to prevent duplication from list?
import java.util.*; public class List {       public static void main(String arg[])       {             Scanner in=new Scanner(System.in);             ArrayList ls=new ArrayList();             int i=0;             while(i<5)             {                   System.out.print("Enter Name - ");                   String s=in.nextLine();                   if(true==ls.contains(s))           …
View On WordPress
0 notes
ittimepass · 7 years ago
Text
Write a program in java to demonstrate List Iterator?
Write a program in java to demonstrate List Iterator?
import java.util.*; public class CollectionList {       public static void main(String arg[])       {             ArrayList ls=new ArrayList();             ls.add("Vikrant");             ls.add("Sunny");             ls.add("Kanir");             ls.add(1,"Abhinandan");             ls.add("Kundan");             System.out.println("Total Number of elements is "+ls.size());            …
View On WordPress
0 notes
ittimepass · 7 years ago
Text
Write a program in java to send the message client to server?
Write a program in java to send the message client to server?
Server import java.io.*; import java.net.*; public class Server {       public static void main(String arg[])       {             try             {                   System.out.println("Running Server");                   ServerSocket ss=new ServerSocket(7777);                   Socket s=ss.accept();                   DataInputStream dis=new DataInputStream(s.getInputStream());                  …
View On WordPress
0 notes
ittimepass · 7 years ago
Text
Write a program to find out IP address of current system?
Write a program to find out IP address of current system?
import java.net.InetAddress; class IPFinder {       public static void main(String arg[])       {             try             {                   InetAddress address=InetAddress.getByName(arg[0]);                   System.out.println("IP Address is "+address.getHostAddress());             }             catch(Exception e)             {                   System.out.println(e);             }       }…
View On WordPress
0 notes
ittimepass · 7 years ago
Text
Write a program in java to display addition of two numbers in applet and numbers must be given at compile time?
Write a program in java to display addition of two numbers in applet and numbers must be given at compile time?
import java.applet.*; import java.awt.*; /*                         */ public class ParamApplet extends Applet {       int a,b,c;       public void init()       {             setBackground(Color.red);             setForeground(Color.yellow);             a=Integer.parseInt(getParameter("num1"));             b=Integer.parseInt(getParameter("num2"));             c=a+b;       }       public void…
View On WordPress
0 notes
ittimepass · 7 years ago
Text
Write a program in java to demonstrate simple applet program? In this program we have simple demonstrate a simple frame. Applet program method must be in an applet package.
Write a program in java to demonstrate simple applet program? In this program we have simple demonstrate a simple frame. Applet program method must be in an applet package.
Tumblr media
import java.applet.*; /*             */ public class SimpleApplet extends Applet {}
View On WordPress
0 notes
ittimepass · 7 years ago
Text
Write a program in java to demonstrate wait(), notify() and notifyAll() method?
Write a program in java to demonstrate wait(), notify() and notifyAll() method?
class Customer1 {       int amount=10000;       public synchronized void withdraw(int amount)       {             if(this.amount<amount)             {                   System.out.println("Less Balance Waiting For Deposit");                   try                   {                         wait();                   }                   catch(Exception e)                   {}             }…
View On WordPress
0 notes
ittimepass · 7 years ago
Text
Write a program in java to demonstrate multi-threading problem?
Write a program in java to demonstrate multi-threading problem?
Multi-threading problem – class Table {       public void printTable(int n)       {             for(int i=1;i<=10;i++)             {                   System.out.println(n*i);                   try                   {                         Thread.sleep(1000);                   }                   catch(Exception e)                   {}             }       } } class MyThread1 extends Thread {…
View On WordPress
0 notes
ittimepass · 7 years ago
Text
Different between invoking run method as a thread i.e. – using start method and as a simple method.
Different between invoking run method as a thread i.e. – using start method and as a simple method.
Using Simple Method – class UserThread extends Thread {       public UserThread(String name)       {             super(name);       }       public void run()       {             System.out.println("run() method is invoked from "+ getName() +" thread.");             for(int i=1;i=1;i--)             {                   System.out.println(i);                   try                   {…
View On WordPress
0 notes
ittimepass · 7 years ago
Text
Write a program to demonstrate multi thread program in java?
Write a program to demonstrate multi thread program in java?
class MyThread1 extends Thread {       public void run()       {             System.out.print("Vikrant ");       } } class MyThread2 extends Thread {       public void run()       {             System.out.print("Kumar ");       } } class MultiThread {       public static void main(String arg[])       {             MyThread1 t1=new MyThread1();             MyThread2 t2=new MyThread2();            …
View On WordPress
0 notes
ittimepass · 7 years ago
Text
Write a program in java to demonstrate user thread in using Indirect way?
Write a program in java to demonstrate user thread in using Indirect way?
class UserThread extends Thread {       public void run()       {             System.out.println("Task 1");       } } class Indirect {       public static void main(String arg[])       {             UserThread x=new UserThread();             x.start();       } }
View On WordPress
0 notes
ittimepass · 7 years ago
Text
Write a program in java to demonstrate user thread in using direct way?
Write a program in java to demonstrate user thread in using direct way?
class ThreadWay implements Runnable {       static       {             Thread t=Thread.currentThread();             System.out.println(t.getName());       }       public void run()       {             Thread t=Thread.currentThread();             System.out.println(t.getName());             System.out.println("Task 1");       } } class Direct {       public static void main(String arg[])       {…
View On WordPress
0 notes
ittimepass · 7 years ago
Text
Write a program in java to demonstrate thread with thread name change?
Write a program in java to demonstrate thread with thread name change?
class ThreadTest {       static       {             Thread t=Thread.currentThread();             System.out.println("Name of current thread "+t.getName());             System.out.println("Priority of thread is "+t.getPriority());             try             {                   t.sleep(5000);                   t.setName("Vikrant");                   t.setPriority(420);             }            …
View On WordPress
0 notes