File tree Expand file tree Collapse file tree 5 files changed +76
-1
lines changed
Expand file tree Collapse file tree 5 files changed +76
-1
lines changed Original file line number Diff line number Diff line change 22<classpath >
33 <classpathentry kind =" src" path =" src" />
44 <classpathentry kind =" con" path =" org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" />
5- <classpathentry kind =" lib" path =" D:/eclipse/lombok.jar" />
5+ <classpathentry kind =" lib" path =" D:/Program Files/eclipse/lombok.jar" />
6+ <classpathentry kind =" lib" path =" D:/Program Files/eclipse/log4j-1.2.17.jar" />
67 <classpathentry kind =" output" path =" bin" />
78</classpath >
Original file line number Diff line number Diff line change 1+ package com .xinan .exception ;
2+
3+ import java .util .InputMismatchException ;
4+ import java .util .Scanner ;
5+
6+ public class Exception01 {
7+ public static void main (String [] args ) {
8+ Scanner sc = new Scanner (System .in );
9+ System .out .println ("大爷,请输入两个数" );
10+ try {
11+ int num1 = sc .nextInt ();
12+ int num2 = sc .nextInt ();
13+ System .out .println ("您输入的两个数的商为:" + num1 / num2 );
14+ } catch (ArithmeticException ae ) {
15+ ae .printStackTrace ();
16+ System .out .println ("ArithmeticException被捕获" );
17+ } catch (InputMismatchException ime ) {
18+ ime .printStackTrace ();
19+ //System.out.println(ime.getMessage());
20+ //System.out.println("InputMismatchException被捕获");
21+ } catch (Exception e ) {
22+ // TODO Auto-generated catch block
23+ //e.printStackTrace();
24+ System .out .println ("Exception被捕获" );
25+ }
26+ }
27+ }
Original file line number Diff line number Diff line change 1+ package com .xinan .exception ;
2+
3+ import org .apache .log4j .Logger ;
4+
5+ public class Lpg4jDemo {
6+ private Logger logger = Logger .getLogger (this .getClass ());
7+ public void logDemo (){
8+ logger .debug ("这是debug级别的信息" );
9+ }
10+ public static void main (String [] args ) {
11+
12+ }
13+ }
Original file line number Diff line number Diff line change 1+ package com .xinan .exception ;
2+
3+ public class TestInteres01 {
4+ public static void main (String [] args ) {
5+ int ret = test1 ();
6+ System .out .println (ret );
7+ }
8+
9+ public static int test1 () {
10+ int a = 1 ;
11+ try {
12+ return
13+ ++a ;
14+ //System.out.println(a);
15+ } finally {
16+ ++
17+ a ;
18+ }
19+
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ # ## \u8BBE\u7F6ELogger\u8F93\u51FA\u7EA7\u522B\u548C\u8F93\u51FA\u76EE\u7684\u5730 ###
2+ log4j.rootLogger =debug, stdout,logfile
3+
4+ # ## \u628A\u65E5\u5FD7\u4FE1\u606F\u8F93\u51FA\u5230\u63A7\u5236\u53F0 ###
5+ log4j.appender.stdout =org.apache.log4j.ConsoleAppender
6+ log4j.appender.stdout.Target =System.err
7+ log4j.appender.stdout.layout =org.apache.log4j.SimpleLayout
8+
9+ # ## \u628A\u65E5\u5FD7\u4FE1\u606F\u8F93\u51FA\u5230\u6587\u4EF6\uFF1Ajbit.log ###
10+ log4j.appender.logfile =org.apache.log4j.FileAppender
11+ log4j.appender.logfile.File =D://jbit.log
12+ log4j.appender.logfile.layout =org.apache.log4j.PatternLayout
13+ log4j.appender.logfile.layout.ConversionPattern =%d{yyyy-MM-dd HH:mm:ss} %l %F %p %m%n
You can’t perform that action at this time.
0 commit comments