-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Project exclude paths | ||
/out/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?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" /> | ||
<orderEntry type="module-library"> | ||
<library name="JUnit4"> | ||
<CLASSES> | ||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.13.1/junit-4.13.1.jar!/" /> | ||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" /> | ||
</CLASSES> | ||
<JAVADOC /> | ||
<SOURCES /> | ||
</library> | ||
</orderEntry> | ||
</component> | ||
</module> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?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" /> | ||
<orderEntry type="module-library"> | ||
<library name="JUnit4"> | ||
<CLASSES> | ||
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.13.1/junit-4.13.1.jar!/" /> | ||
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" /> | ||
</CLASSES> | ||
<JAVADOC /> | ||
<SOURCES /> | ||
</library> | ||
</orderEntry> | ||
</component> | ||
</module> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.mjz; | ||
|
||
import org.junit.Test; | ||
|
||
/** | ||
* @PACKAGE_NAME: com.mjz | ||
* @author: JHZZ | ||
* @date: 2021/11/4 23:24 | ||
* @PROJECT_NAME: JavaProjects | ||
*/ | ||
public class Main { | ||
public static void main(String[] args) { | ||
|
||
MyLinkList mll = new MyLinkList(); | ||
for (int i = 1; i <= 10 ; i++) { | ||
mll.addLast(i); | ||
} | ||
mll.print(); | ||
mll.deleteFirst(); | ||
mll.print(); | ||
mll.addFirst(4); | ||
mll.print(); | ||
mll.deleteLast(); | ||
mll.deleteFirst(); | ||
mll.print(); | ||
System.out.println(test()); | ||
} | ||
|
||
public static int test(){ | ||
try { | ||
int n=10; | ||
int i = n / 0; | ||
return 10; | ||
}catch(Exception e){ | ||
System.out.println(e.getStackTrace()); | ||
}finally { | ||
System.out.println("finally"); | ||
return 20; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package com.mjz; | ||
|
||
/** | ||
* @PACKAGE_NAME: com.mjz | ||
* @author: JHZZ | ||
* @date: 2021/11/4 23:13 | ||
* @PROJECT_NAME: JavaProjects | ||
*/ | ||
public class MyArrays { | ||
private int capacity = 10; | ||
private int length = 0; | ||
private int[] arr; | ||
|
||
public MyArrays() { | ||
arr = new int[10]; | ||
} | ||
|
||
public MyArrays(int capacity) { | ||
this.capacity = capacity; | ||
arr = new int[capacity]; | ||
} | ||
|
||
public MyArrays(int[] arr) { | ||
this.arr = arr; | ||
} | ||
|
||
public int get(int index){ | ||
return arr[index]; | ||
} | ||
public int getLength() { | ||
return length; | ||
} | ||
|
||
public int getCapacity() { | ||
return capacity; | ||
} | ||
|
||
public void insert(int val) { | ||
if (capacity == length){ | ||
//扩容操作 | ||
System.out.println("扩容操作"); | ||
int[] newarr=new int[arr.length*2]; | ||
newarr = arr.clone(); | ||
arr=newarr; | ||
|
||
}else{ | ||
arr[length++] = val; | ||
} | ||
} | ||
public int remove(int index) { | ||
if (index >= capacity && index < 0){ | ||
return -1; | ||
}else if(index >= length){ | ||
return -1; | ||
} | ||
for (int i = index; i <length ; i++) { | ||
arr[i] = arr[i+1]; | ||
} | ||
|
||
length--; | ||
return arr[index]; | ||
} | ||
public void print(){ | ||
System.out.print("["); | ||
for (int i = 0; i < length; i++) { | ||
System.out.print(arr[i]+" "); | ||
} | ||
System.out.println("]"); | ||
} | ||
} |