1: When Java Meets Jeju

AP Computer Science A Aug 14, 2023

Java at a Glance

Hey there, KISJ warriors! 🚀 Ever felt like your school's Wi-Fi is as slow as a turtle racing through molasses? Or that the school lunch is . . . well, let's just say it's not exactly Michelin-starred? 😅 Well, let's dive into something that's actually cool: Java. And no, not the drink you wish you had during those late-night cramming sessions.

  1. Object-Oriented: Think of Java like your school. Each student (object) belongs to a grade (class). And just like how some of you clutch onto 9 LLBs every semester (you daredevils!), objects in Java follow certain rules set by their classes.
  2. Platform Independence: Java is like K-pop. Doesn't matter where you are in the world, it's universally loved! Thanks to something called bytecode, Java can run on any device with a JVM.
  3. Security: Java's security is tighter than our librarian's rules about talking in the library. It operates in a sandbox, so no sneaky stuff can get in or out.
  4. Robustness: Java is as reliable as that one friend who always has the Tetris extension on during class. (You know who you are!)

Commenting in Java: Beyond Just Code

In Java, comments aren't merely annotations; they provide context, making code understandable and maintainable.

Program Headers: Like introducing yourself on the first day of school.

/**
 * [Addition.java]
 * This program tracks the number of LLB per students
 * Author: JaeWoong Suh
 * Class: AP Computer Science A
 * Created: August 14, 2023
 */

Block Comments: These are like those long talk after you have an assessment. Starts with /* and ends with */.

Line Comments: Quick whispers in class. Just use // and you're good to go.

Java Classes: The Building Blocks

class ruleStuff{
}

Classes in Java are like the cliques in school. They define how their members (objects) behave. And when you compile this code, you get a .class file, which is like the secret handshake of that clique.

The Grand Entrance: Main Method

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

Every Java program starts with the main method, kind of like how every school year starts with a strict phone usage policy . . . which we all know doesn't last long. 😂

Java's Code & API

Commands like System.out.println("Hello world") are the basics. It's like saying "Annyeong" to your friends. And Java's Application Programming Interface (API)? Think of it as the ultimate cheat sheet for your exams. It's ready-to-use classes and methods, systematically arranged in a hierarchical manner.

Making Java Talk: Printing Lines

Want to make Java talk? Use System.out.println(). It's like shouting "Hello, world!" in the middle of the cafeteria. (But maybe don't actually do that.)

Taking My First Steps: The "Hello World!" Program

Remember when you first stepped into KISJ, nervous but excited? Writing your first "Hello World!" program in Java feels the same. Here's how:

public class HelloWorldProgram {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}
  1. Save the code in a file named HelloWorldProgram.java.
  2. Compile with javac HelloWorldProgram.java.
  3. Run with java HelloWorldProgram.

And voila! You'll see "Hello World!" pop up, kind of like how an A+ on your report card makes your Korean mom's eyes light up. (Anything less and it's basically an F, right?)


So, budding coders of KISJ, give Java a shot. And remember, every coding genius was once a beginner . . . probably also trying to sneak their phone out in class. 😉 Happy coding! 🎉👩‍💻👨‍💻

Tags