Skip to main content

Chapter 7: Java Basics ☕

This cheat sheet covers Java syntax and core features for Chapter 7 of the GSEB Std 12 Computer Studies syllabus.

🎯 Key Concepts

  • Java: High-level, object-oriented language developed by James Gosling (Sun Microsystems).
  • Bytecode: The platform-independent format (saved as .class) that runs on the JVM.
  • WORA: "Write Once, Run Anywhere."

🛠️ JDK Development Tools

ToolFull NameDescription
javacJava CompilerConverts source code (.java) to bytecode (.class).
javaJava InterpreterExecutes the bytecode on the JVM.
jdbJava DebuggerHelps find and fix errors in the code.
javadocDoc GeneratorAutomatically generates documentation from comments.
appletviewerApplet ViewerUsed to view and test Java applets (older tech).

⚙️ Java Tokens & Data Types

1. Java Tokens

  • Keywords: Reserved words like class, public, int, static (50+ words).
  • Identifiers: Names for variables, classes, and methods. Must not start with a digit.
  • Literals: Constant values (e.g., 100, "hello", true).
  • Operators: Symbols like +, -, *, /.
  • Separators: Characters like ( ), { }, [ ], ;, ,.

2. Primitive Data Types & Sizes

  • Boolean: 1 bit (true or false).
  • Character: 2 bytes (uses Unicode character set).
  • Integer Types: byte (1), short (2), int (4), long (8).
  • Floating Types: float (4), double (8).

🔒 Control Structures & Loops

1. Selection (Decision)

  • if Statement: Checks a condition.
  • switch: Multi-way branching based on a variable's value.

2. Iteration (Loops)

  • Entry Controlled Loops: Condition checked before execution (for, while).
  • Exit Controlled Loops: Condition checked after execution (do-while).
  • break: Exits the loop immediately.
  • continue: Skips the rest of the current iteration and goes to the next.

💡 Board Focus: High-Weightage Points 👔

  • MCQ Alert: Java uses Unicode (16-bit) characters, unlike C/C++ which use ASCII.
  • MCQ Alert: The javac command compiles; java command runs.
  • MCQ Alert: main() is the entry point and must return void.
  • MCQ Alert: Single quotes are for char ('A'), double quotes for String ("ABC").
  • MCQ Alert: Java is case-sensitive.

Board Exam Secret

GSEB frequently asks about "Exit Controlled" loops. Remember: do-while will execute at least once even if the condition is false!


Std 12 Hub | Next: Chapter 8 Cheat Sheet

📍 Visit Us

🏫 VD Computer Tuition Surat

VD Computer Tuition
📍 Address
2/66 Faram Street, Rustompura
Surat395002, Gujarat, India
📞 Phone / WhatsApp
+91 84604 41384
🌐 Website

Computer Classes & Tuition — Areas We Serve in Surat

AdajanAlthanAmroliAthwaAthwalinesBhagalBhatarBhestanCanal RoadChowkCitylightDumasGaurav PathGhod Dod RoadHaziraJahangirpuraKamrejKapodraKatargamLimbayatMagdallaMajura GateMota VarachhaNanpuraNew CitylightOlpadPalPandesaraParle PointPiplodPunaRanderRing RoadRustampuraSachinSalabatpuraSarthanaSosyo CircleUdhnaVarachhaVed RoadVesuVIP Road
📞 Call Sir💬 WhatsApp Sir