From 5c029c9af1e5961ca8b902f648ff4797cc14df9e Mon Sep 17 00:00:00 2001 From: Lokesh Singh <63910828+Lokesh598@users.noreply.github.com> Date: Wed, 18 May 2022 10:14:46 +0530 Subject: [PATCH] Add files via upload --- Java Classes/exception.java | 15 +++++++++++++++ Java Classes/tempCodeRunnerFile.java | 1 + Java Classes/thread.java | 13 +++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 Java Classes/exception.java create mode 100644 Java Classes/tempCodeRunnerFile.java create mode 100644 Java Classes/thread.java diff --git a/Java Classes/exception.java b/Java Classes/exception.java new file mode 100644 index 0000000..6ee205d --- /dev/null +++ b/Java Classes/exception.java @@ -0,0 +1,15 @@ + + +public class exception { + public static void main(String[] args) { + try { + int arr[] = {1,2,3}; + System.out.println(arr[1]); + } + catch (Exception e) { + System.out.println("Something went wrong"); + } finally { + System.out.println("try catch block finished"); + } + } +} diff --git a/Java Classes/tempCodeRunnerFile.java b/Java Classes/tempCodeRunnerFile.java new file mode 100644 index 0000000..f59ec20 --- /dev/null +++ b/Java Classes/tempCodeRunnerFile.java @@ -0,0 +1 @@ +* \ No newline at end of file diff --git a/Java Classes/thread.java b/Java Classes/thread.java new file mode 100644 index 0000000..8e36704 --- /dev/null +++ b/Java Classes/thread.java @@ -0,0 +1,13 @@ + + public class thread extends Thread { + public void run() { + System.out.println("Hello! this code is running in a thread"); + } + + public static void main(String[] args) { + thread m = new thread(); + m.start(); + System.out.println("Hello! this code is running outside of the main thread"); + } + } + -- 2.18.1