HKProgrammingWorld
Think Java...Think HK,
Learning is Simplified. Believe Us...Success is Yours. This page is created This page is created and maintaining by Mr.
16/04/2022
//run() method ex*****on flow test cases
===============================
class MyRunnable implements Runnable {
public void run(){
System.out.println("From MyRunnable.run() ");
}
}
class MyThread extends Thread {
MyThread(){
super();
}
MyThread(Runnable target){
super(target);
}
public void run(){
System.out.println("From MyThread.run() ");
super.run();
}
}
class Test04_RunExecution{
public static void main(String[] args) {
/*
Thread th1 = new Thread();
th1.start();
MyThread mt = new MyThread();
mt.start();
MyRunnable mr = new MyRunnable();
mr.start();
Thread th2 = new Thread(mr);
th2.start();
MyThread mt = new MyThread();
Thread th3 = new Thread(mt);
th3.start();
Thread th4 = new MyThread();
th4.start();
Thread th5 = new MyRunnable();
th5.start();
Runnable r = new MyRunnable();
r.start();
Thread th6 = new Thread(r);
th6.start();
MyRunnable mr2 = new MyRunnable();
MyThread mt2 = new MyThread(mr2);
mt2.start();
MyThread mt3 = new MyThread();
MyThread mt4 = new MyThread(mt3);
mt4.start();
*/
// MyThread mt5 = new MyThread(mt5);
// mt5.start();
mt6 = new MyThread(mt6);
mt6.start();
}
static MyThread mt6;
}
12/03/2022
/*
* Types of arrays
* Java supports three types of arrays
* 1. One dimensional array
* 2. Multi dimensional array [2D, 3D, ..., n D]
* 3. Jogged array [multi dimensional array with diff size child arrays]
*/
class Test15_TyoeOfArrays{
public static void main(String[] args){
//array of values
int[] ia1 = new int[5];
int[] ia2 = {3, 4, 5, 6, 7};
//array of arrays or 2D array
//DT[][] vn = new DT[parentSize][childSize];
// M O
int[][] iaa = new int[3][2];
//parent array locations -> 3
//child array locations -> 2
//how many parent arrays -> 1
//how many child arrays -> 3 with 2 locations
System.out.println(iaa);
System.out.print(" "+iaa[0] +" ----> "); System.out.println(iaa[0][0] +" " + iaa[0][1]);
System.out.print(" "+iaa[1] +" ----> "); System.out.println(iaa[1][0] +" " + iaa[1][1]);
System.out.print(" "+iaa[2] +" ----> "); System.out.println(iaa[2][0] +" " + iaa[2][1]);
System.out.println();
long time1, time2;
time1 = System.currentTimeMillis();
for(int i=0;i
Click here to claim your Sponsored Listing.
Category
Contact the business
Telephone
Website
Address
Ameerpet
Hyderabad
500016