Skip to content

bwreid/java-syntax-notes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

At this point the following should work. If you're done, install a Java Linter on your editor of choice.

java -version
javac -help

Java

What is it?

An object-oriented programming language. It is compiled to bytecode which can then run on any Java Virtual Machine (JVM).

Why is it rad?

  • Statically typed, which ensures functions return a certain type of result. This catches bugs early on in the process.
  • Compiled to bytecode which can then be run on any JVM regardless of computer architecture.
  • It's super popular and can gain you entry to lots of companies.

Why is it not rad?

  • Owned by Oracle.
  • Very verbose compared to other languages.
  • Requires compilation which can be kind of slow.

I Do

Write a basic HelloWorld class. Output some text to the screen.

Checks for Understanding

  • What is void doing?
  • What do you expect to happen if we change void to a different type?
  • What is required to run a simple Java program?
    • A main method
    • Compile with javac
    • Run with java

We Do

Let's make a simple Aloof class that makes something we say more aloof. For example:

I love rain >> I love rain, I guess...

  • Create a new class called Aloof.
  • Create a main function.
  • Let's talk about "args" -- we will go over this soon but it's an array of strings. It will take arguments we pass in and put them into an array.
  • Access the first item in the array and print it out along with ", I guess..."

Checks for Understanding

  • What is args?
    • An array of arguments passed in after running the java file.
  • How can you access values in arrays in Java?
    • With bracket notation!

You Do

Go through the syntax section up until Arrays (we'll cover that after lunch). We'll come back together at 11:15am to go over some of what we learned.

Re-group

Checks for Understanding

  • What is the difference between an instance and class method?
    • Class methods can be called internally (and off the class).
    • Instance methods require an instance to be created first.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published