first commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package com.baeldung.supertypecompilerexception;
|
||||
|
||||
public class MyClass {
|
||||
|
||||
private int myField1 = 10;
|
||||
private int myField2;
|
||||
|
||||
public MyClass() {
|
||||
//uncomment this to see the supertype compiler error:
|
||||
//this(myField1);
|
||||
}
|
||||
|
||||
public MyClass(int i) {
|
||||
myField2 = i;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.baeldung.supertypecompilerexception;
|
||||
|
||||
public class MyClassSolutionI {
|
||||
|
||||
private int myField1 = 10;
|
||||
private int myField2;
|
||||
|
||||
public MyClassSolutionI() {
|
||||
myField2 = myField1;
|
||||
}
|
||||
|
||||
public MyClassSolutionI(int i) {
|
||||
myField2 = i;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.baeldung.supertypecompilerexception;
|
||||
|
||||
public class MyClassSolutionII {
|
||||
|
||||
private int myField1 = 10;
|
||||
private int myField2;
|
||||
|
||||
public MyClassSolutionII() {
|
||||
setupMyFields(myField1);
|
||||
}
|
||||
|
||||
public MyClassSolutionII(int i) {
|
||||
setupMyFields(i);
|
||||
}
|
||||
|
||||
private void setupMyFields(int i) {
|
||||
myField2 = i;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.baeldung.supertypecompilerexception;
|
||||
|
||||
public class MyClassSolutionIII {
|
||||
|
||||
private static final int SOME_CONSTANT = 10;
|
||||
private int myField2;
|
||||
|
||||
public MyClassSolutionIII() {
|
||||
this(SOME_CONSTANT);
|
||||
}
|
||||
|
||||
public MyClassSolutionIII(int i) {
|
||||
myField2 = i;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.baeldung.supertypecompilerexception;
|
||||
|
||||
public class MyException extends RuntimeException {
|
||||
private int errorCode = 0;
|
||||
|
||||
public MyException(String message) {
|
||||
//uncomment this to see the supertype compiler error:
|
||||
//super(message + getErrorCode());
|
||||
}
|
||||
|
||||
public int getErrorCode() {
|
||||
return errorCode;
|
||||
}
|
||||
}
|
||||
19
core-java-lang-oop-2/src/main/resources/logback.xml
Normal file
19
core-java-lang-oop-2/src/main/resources/logback.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org.springframework" level="WARN" />
|
||||
<logger name="org.springframework.transaction" level="WARN" />
|
||||
|
||||
<!-- in order to debug some marshalling issues, this needs to be TRACE -->
|
||||
<logger name="org.springframework.web.servlet.mvc" level="WARN" />
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
||||
13
core-java-lang-oop-2/src/test/resources/.gitignore
vendored
Normal file
13
core-java-lang-oop-2/src/test/resources/.gitignore
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
*.class
|
||||
|
||||
#folders#
|
||||
/target
|
||||
/neoDb*
|
||||
/data
|
||||
/src/main/webapp/WEB-INF/classes
|
||||
*/META-INF/*
|
||||
|
||||
# Packaged files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
Reference in New Issue
Block a user