Code Monkey home page Code Monkey logo

Comments (11)

jerry80409 avatar jerry80409 commented on May 30, 2024

b

from java-course.

github-learning-lab avatar github-learning-lab commented on May 30, 2024

Correct! That answer is describing JavaScript (which is entirely different than Java).

Prepare your environment

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!)

  • Check if Java is installed and set path
  • Download a text editor
  • Clone your course repository using git

Check that Java is installed

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.

Download a text editor

Make sure you have a text editor installed before proceeding (such as Atom, Sublime Text, or Notepad++).

Clone course repository

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/jerry80409/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

from java-course.

github-learning-lab avatar github-learning-lab commented on May 30, 2024

Compiling vs Running Code

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.

from java-course.

github-learning-lab avatar github-learning-lab commented on May 30, 2024

Sorry, that is not the right answer. 😢
Try again! 😄

from java-course.

github-learning-lab avatar github-learning-lab commented on May 30, 2024

Sorry, that is not the right answer. 😢
Try again! 😄

from java-course.

jerry80409 avatar jerry80409 commented on May 30, 2024

yes

from java-course.

github-learning-lab avatar github-learning-lab commented on May 30, 2024

Sorry, that is not the right answer. 😢
Try again! 😄

from java-course.

jerry80409 avatar jerry80409 commented on May 30, 2024

no

from java-course.

github-learning-lab avatar github-learning-lab commented on May 30, 2024

Sorry, that is not the right answer. 😢
Try again! 😄

from java-course.

jerry80409 avatar jerry80409 commented on May 30, 2024

true

from java-course.

github-learning-lab avatar github-learning-lab commented on May 30, 2024

Correct! You need to re-compile your java file using the javac command each time you want to run code with the java command.

I've opened a new issue with the next steps.

from java-course.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.