Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.
The workspace contains two folders by default, where:
src
: the folder to maintain sourceslib
: the folder to maintain dependencies
Meanwhile, the compiled output files will be generated in the bin
folder by default.
If you want to customize the folder structure, open
.vscode/settings.json
and update the related settings there.
The JAVA PROJECTS
view allows you to manage your dependencies. More details can be found here.
- Java Virtual Machine(JVM) is responsible for the hardware- and operating system-independence of the Java SE platform, the small size of compiled code (bytecodes), and platform security
- I CAN LABEL MY LOOPS
- Java passes everything by value
- For primitives, the value is just a number
- For objects, the value is the memory address (reference)
- If I want my decimal value to have the float datatype, I HAVE TO HAVE THE F or f
- Java is platform Independent, so code compiled on Windows can run on Linux, as long as it the Java Runtime Environment
- Ifs, for and while loops have their own scope unlike python
- Variable declarations are bound to their scope, and you cannot redeclare a variable in the same scope
- If finally block has a return statement, it overrides any return from try or catch blocks
- Local variables(like in methods) can't be private
- Private variables and methods aren't inherited so they can't be overriden
- STRINGS ARE IMMUTABLE
- StringBuilder is mutable
- Switch doesn't take in booleans!!
- Can't use both super(...) and this(...) in a constructor, only one and must be the first statement
- commas aren't used to seperate cli arguments
- Inside a static method, you cannot directly access non-static (instance) variables
- For lambda, when { } are used, a return is needed