Open github-learning-lab[bot] opened 2 years ago
b
Correct! That answer is describing JavaScript (which is entirely different than Java).
Before we can start writing Java, we need to make sure you have your environment set up. You just need a few things (some of which you might already have!)
Your machine may already have Java, or you might need to install it. To find out, go to your command line terminal and type:
java -version
Then type:
javac -version
If you see your Java version displayed for each of these, you're all set!
Otherwise, you'll need to download Java for your operating system.
The next step is to set the java file path by developing a new environmental variable. Go to the link above for instructions on how to find and set the path for Java. (if you already have a path variable, you can add a ; to the end and include the next path afterwards).
When you make a new environmental variable, you need to close and re-open your terminal. Do this now, then type these lines to make sure the path was set correctly.
java -version
javac -version
You should see a version for each of these if it was correctly installed.
Make sure you have a text editor installed before proceeding (such as Atom, Sublime Text, or Notepad++).
You will be storing the code for this project in this repository. Before we go any further, clone your template project into the directory you want to store your code locally in, using git:git clone https://github.com/Adam8151/java-course.git
To test that your project is set up correctly, navigate into the folder you cloned and run these commands:
javac custom_order.java
java custom_order
If everything was set up correctly, you should see "Hello World!" printed in your command terminal. We'll describe what we just did in the next step.
When you have finished these steps, leave a comment for the next step
The first command we entered javac custom_order.java
will create a 'class' file, which is machine-readable code. The class file may be hidden on your text editor, since you should never directly edit this file. You can see it by typing ls
into the terminal. When we ran the java custom_order
command, we told the computer to read that class file. Therefore, we need to re-compile our code each time we make changes that we want to run.
Open the custom_order.java file in your text editor to view the code before it is compiled. We will be editing this code to create a Java Cake & Cupcake Shop ordering system!
Before you continue, is the following statement is true or false?
You need to re-compile your code each time you want to test edits to your java file.
Sorry, that is not the right answer. 😢
Try again! 😄
Java Course
Java is a popular programming language for several main reasons:
Java is considered an Object Oriented programming language, making it easy to encapsulate data (and methods) in a class. A class is like a blue-print that contains all the properties that will be inherited by the objects created by it. This makes it easy to organize and re-use blocks of code.
Java is also a compiled language, meaning that it needs to be translated into machine readable code before it can run.
GitHub Learning Lab Instructions
This is an interactive course, where you will be prompted to do something to finish each step.
If it takes more than a few seconds for a response, try refreshing your browser.
Add a comment to this issue with the letter that answers this question.
Which of the following is false about Java?
a. Java is an Object Oriented programming language b. Java is a scripting language, read only in the browser c. Java files need to be compiled before you can run them