0% found this document useful (0 votes)
27 views9 pages

Meeting2 Java Basics Discussion

This document covers the basics of Java programming, including syntax, variables, and data types. It emphasizes the structure of a Java program, the importance of the main() method, and the need for variable declarations with specific data types. Additionally, it provides examples of Java syntax and encourages hands-on activities to reinforce learning.

Uploaded by

mis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views9 pages

Meeting2 Java Basics Discussion

This document covers the basics of Java programming, including syntax, variables, and data types. It emphasizes the structure of a Java program, the importance of the main() method, and the need for variable declarations with specific data types. Additionally, it provides examples of Java syntax and encourages hands-on activities to reinforce learning.

Uploaded by

mis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Meeting 2 – Java

Basics: Syntax,
Variables, and Data
Types

 Understand the
structure of a basic
Java program
 Identify and apply
Java syntax rules
 Declare and use
variables, values,
and strings in Java
 Every Java program must have a
class
 The main() method is the entry
point of execution

Java  [Link]() displays output


 Example:
Program  public class HelloJava {
Structur  public static void main(String[]
args) {
e  [Link]("Hello,
World!");
 }
 }
Basic Java Syntax Rules

Java is case- Every statement


sensitive (Main ≠ ends with a
main) semicolon ;

Code blocks are


Use meaningful
enclosed in curly
variable names
braces { }
Variables
in Java
 A variable is a
named storage
location in
memory
 Must be declared
with a data type
before use
 Example: int age =
20;
 int → whole numbers
 double → decimal numbers
Java Data  String → text

Types 

Example:
String name = "Maria";
 double gpa = 1.75;
Strings in Java

A SEQUENCE OF EXAMPLE: STRING SCHOOL = [Link]


CHARACTERS "MIT OZAMIZ"; N("I STUDY AT " +
ENCLOSED IN SCHOOL);
DOUBLE QUOTES " "
Sample Program –
Personal Information
 public class PersonalInfo {
 public static void main(String[] args) {
 String name = "Juan Dela Cruz";
 String course = "BSCS";
 int year = 1;
 String school = "MIT Ozamiz";
 [Link]("Name: " + name);
 [Link]("Course: " + course);
 [Link]("Year Level: " + year);
 [Link]("School: " + school);
 }
 }
 Java programs follow a structure:
class → main method → statements
Summary  Variables store values and must have
/ Key a data type
 Strings allow us to work with text
Takeaways  Writing and running simple programs
helps understand Java fundamentals
 Hands-on: Write a Java program that
displays your name, course, year
level, and school
Activities  Group Work: Analyze a short Java
code snippet and identify variables,
data types, and output statements

You might also like