In this course, you will learn the basics of the #1 language in the world. Java is taught as an introductory language in CS courses all over the world. You will be among CS students from the best universities.
- Introduction
- Algorithms
- Conditional Statements
- Switch/Case
- Loops
- Arrays
- Matrix
- Strings
- Functions/Methods
- Black Box
- White Box
- Input/Output
- Passing by value
- Passing by reference
- Fibonacci's Sequence
- Prime Numbers
- Magic Matrix
- More about Strings
- Pow
First off, what is an IDE? An IDE (Integrated Development Environment) is a place for coders to change the code of the program they're working on. From the tiniest of projects to the largest you will need an IDE, which one you choose is up to you. For this tutorial we will be using Eclipse, but there are plenty of other choices.
Go to the Eclipse website and download the latest version of Eclipse. Currently, it is Eclipse Oxygen.
- Click "Eclipse IDE for Java Developers". This will install the IDE, a git (version control) client, and a couple of other editors for advanced Java development.
- Change the install path (if you want to), click install, then accept the terms and conditions.
- Launch Eclipse. Click 'Launch' when the program asks about a directory for the workspace.
- Click 'File' -> 'New' -> 'Java Project'. Enter a name for your project, and click 'Finish'.
- Right click on your project in the left pane, choose 'New', and select 'Class'. Name it 'Main'.
- Click 'Finish' and you're done! You can now do all of the examples in this repository!
- Download java jdk from the website install it in the host machine and install the path.
- Download a text editor (Sublime, Atom, etc) and start writing the code.
- Open terminal go to the folder where your java code is saved and compile the file using the command javac classname.java.
- After successfully compiling the code java will create a class file with name classname.class.
- Next step is to execute the file in the terminal,command for executing is java classname.
- Boom!! there is your output "Hello world!".
Maven is a way to simplify the way projects are build. Where the earlier projects only contain a few Java files, Maven is capable of handling the full lifecycle (downloading third party software, compilation, testing, updating documentation), which would be a real error-prone chore to do by hand (can you imagine running thousands of tests by hand using main() methods?). This can be done inside an IDE or through a terminal using 'mvn '. See 'Working with Maven' below for a few examples relevant to this repository. But note that Mavens capabilities go way beyond what is required in this repository.
At the time of writing, chapter 16 and 17 has Maven incorporated, which can be recognized by the 'pom.xml' in these projects. They both refer to the 'pom.xml' in the root of this repository as their parent. This is used to share information between multiple projects, while only defining it once (in the parent). The other way around, the parent refers to the chapter 16 and 17 projects as submodules. This means that whatever task Maven is given, it will also execute it on all its submodules.
Sources:
- Download Maven (3+) from http://maven.apache.org
- Unpack the folder and add the /bin directory to your PATH variable (http://www.baeldung.com/install-maven-on-windows-linux-mac)
- Open the terminal and go to the project folder
- Run 'mvn test' to run all the tests and verify everything is still working.