knowt ap exam guide logo

Java Basics

  • class header is like the title

    • public class Myclass {}

  • line 2 is a method header

    • method header live inside classes

    • public static void main(String[] args){}

  • line 3 is a print statement

    • statements live inside method header

    • System.out.println(”Hello world!”);

  • public and private are the two we’ll use

    • public means code outside the class can call it

    • private means code outside the class can’t call it

  • static means the method is on a class and not an object

  • void means it doesn’t return a value

  • strings are a datatype

  • square brackets are an array

  • args is the variable

AC

Java Basics

  • class header is like the title

    • public class Myclass {}

  • line 2 is a method header

    • method header live inside classes

    • public static void main(String[] args){}

  • line 3 is a print statement

    • statements live inside method header

    • System.out.println(”Hello world!”);

  • public and private are the two we’ll use

    • public means code outside the class can call it

    • private means code outside the class can’t call it

  • static means the method is on a class and not an object

  • void means it doesn’t return a value

  • strings are a datatype

  • square brackets are an array

  • args is the variable

robot