OOPJ lab programs
OOPJ lab programs
Input:
try {
} catch (ArrayIndexOutOfBoundsException e) {
} catch (Exception e) {
} finally {
Output:
Input:
this.number = number;
try {
if (number == 3) {
Thread.sleep(1000);
} catch (InterruptedException e) {
} catch (RuntimeException e) {
}
public class MultiThreadExceptionHandling {
t.start();
Output:
Thread 4 started.
Thread 2 started.
Thread 1 started.
Thread 5 started.
Thread 3 started.
Thread 2 finished.
Thread 4 finished.
Thread 5 finished.
Thread 1 finished.
6. Create java program with the use of java packages.
Input:
StudInfo.java
package StudentInfo;
this.name=name;
this.age=age;
this.email=email;
return name;
return age;
MainApp.java
import StudentInfo.StudInfo;
s.displayInfo();
Output:
Student Age: 23
Input:
import java.io.*;
public class IO {
writer.write(content);
} catch (IOException e) {
String line;
while((line=reader.readLine())!=null) {
System.out.println(line);
} catch(IOException e) {
}
Output:
File content: