-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a89444
commit cface42
Showing
7 changed files
with
168 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
### IntelliJ IDEA ### | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import java.io.*; | ||
import java.nio.file.Paths; | ||
import java.util.Scanner; | ||
|
||
public class Main { | ||
public static class MyException extends Exception { | ||
public MyException(String arg) { | ||
super(arg); | ||
} | ||
}; | ||
|
||
static void foo(Object arg) throws FileNotFoundException, MyException { | ||
// try { | ||
if (arg == null) | ||
throw new MyException("Invalid argument"); | ||
|
||
throw new FileNotFoundException(); | ||
// do some work | ||
// } catch (FileNotFoundException e) { | ||
// throw new RuntimeException(e); | ||
// } | ||
} | ||
|
||
static void bar() throws MyException { | ||
System.out.println("Hello world!"); | ||
|
||
try { | ||
foo(null); | ||
} catch (FileNotFoundException e) { | ||
// System.out.println(e.getStackTrace()); | ||
e.printStackTrace(); | ||
} catch (MyException e) { | ||
// System.out.println(e.getStackTrace()); | ||
e.printStackTrace(); | ||
// return; | ||
throw e; | ||
} finally { | ||
System.out.println("In main finally"); | ||
} | ||
|
||
System.out.println("AFter catch"); | ||
} | ||
|
||
static void baz() { | ||
// InputStream is = new BufferedInputStream(System.in); | ||
// BufferedInputStream is = new BufferedInputStream(System.in); | ||
// DataInputStream dis = new DataInputStream(is); | ||
|
||
// try { | ||
// int c; | ||
// while((c = is.read()) != -1) { | ||
// System.out.println(c); | ||
// } | ||
// } catch (IOException e) { | ||
// System.out.printf("Failed to read"); | ||
// System.out.printf(e.getMessage()); | ||
// } | ||
|
||
// try { | ||
// int a = dis.readInt(); | ||
// String b = dis.readLine(); | ||
// System.out.println(a); | ||
// System.out.println(b); | ||
// } catch (IOException e) { | ||
// System.out.printf("Failed to read"); | ||
// System.out.printf(e.getMessage()); | ||
// } | ||
BufferedReader br = new BufferedReader( | ||
new InputStreamReader(System.in) | ||
); | ||
try { | ||
System.out.println(br.readLine()); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
Scanner sc = new Scanner( | ||
new BufferedInputStream(System.in) | ||
); | ||
while(sc.hasNextLine()) { | ||
sc.nextLine(); | ||
} | ||
|
||
try { | ||
Scanner fsc = new Scanner( | ||
// new FileInputStream("./in.txt") | ||
// new BufferedInputStream( | ||
// new FileInputStream("./in.txt") | ||
// ) | ||
// "./in.txt" | ||
Paths.get("./in.txt") | ||
); | ||
|
||
} catch (FileNotFoundException e) { | ||
e.printStackTrace(); | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
public static void main(String[] args) throws MyException { | ||
// bar(); | ||
baz(); | ||
} | ||
} |