Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Dec 5, 2023
1 parent 7186f5c commit 4433030
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 9 deletions.
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
30 changes: 30 additions & 0 deletions src/main/java/Workspace/project1/myPrint.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package Workspace.project1;

class MyClass{

void myPrint(int width){
if (width % 2 == 0){
System.out.println("width should be odd");
return;
}
String star = "*";
for (int i = width; i >= 0; i-=2){
System.out.println(star.repeat(i));
}
for (int i = 3; i <= width; i+=2){
System.out.println(star.repeat(i));
}

}
}

public class myPrint {
public static void main(String[] args) {

MyClass myClass = new MyClass();
int width = 5;
//int width = 7;
myClass.myPrint(width);
}

}
9 changes: 0 additions & 9 deletions src/main/java/Workspace/workspace3.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@
public class workspace3 {
public static void main(String[] args) {

// // 获取 Java 线程管理 MXBean
// ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
// // 不需要获取同步的 monitor 和 synchronizer 信息,仅获取线程和线程堆栈信息
// ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(false, false);
// // 遍历线程信息,仅打印线程 ID 和线程名称信息
// for (ThreadInfo threadInfo : threadInfos) {
// System.out.println("[" + threadInfo.getThreadId() + "] " + threadInfo.getThreadName());
// }

Solution s = new Solution();

// test 1
Expand Down

0 comments on commit 4433030

Please sign in to comment.