Will give brief about repo here later (It's working?)
change 1
change 2
change 3
This repo is a Maven project (pom.xml). IntelliJ and VS Code both read it automatically, so there are no scripts to run, no terminal steps, and debugging works.
- IntelliJ IDEA: open this folder (File → Open). If you open the parent
reposfolder instead, right-clickpom.xml→ Add as Maven Project (one time only). Then click the green ▶ next to anymain→ Run or Debug. - VS Code: open this folder (or the parent
reposfolder) and wait for the Java status bar to say it's ready. Click Run / Debug above anymain, or press F5 with the file open. - Terminal (optional):
javac -d target/classes -sourcepath src/main/java src/main/java/basics/Hello.javathenjava -cp target/classes basics.Hello
The IDE compiles the whole repo before running a single file, so one broken file stops all of them.
- Code lives in
src/main/java/<Topic>/and starts withpackage <Topic>;. Create files with New → Java Class so the IDE writes this line for you. - A helper class used by only one program goes inside that program's class, e.g.
static class Node { ... }. Two top-level classes with the same name in one folder cause a "duplicate class" error, and then nothing runs. This was the old problem. - The file name must match its
public class:public class GreedyExs3goes inGreedyExs3.java. To rename, use Refactor → Rename on the class so the IDE renames the file too. - If a file is half-finished and doesn't compile, comment out the broken part before moving on.
OPPS_ADV/VirtualThread*.javaneed JDK 21.pom.xmlskips them while JDK 17 is installed (the steps to switch are in the comment there).