tailieunhanh - Object Oriented Programming - Lesson 2.1: Java syntax basics

Object Oriented Programming - Lesson : Java syntax basics Understand the Java syntax basics and their semantics for writing a program. It includes Structure of a Java program, White space, Separators, Comments, Identifiers and keywords, Data types and literals, Comment line arguments. | LESSON Java syntax basics Trinh Thanh TRUNG (MSc) trungtt@ Objectives • Understand the Java syntax basics and their semantics for writing a program. Structure of a Java program Program • Package – Class • Methods – block » Statement • Expression • Token Book • Part – Chapter • section – Paragraph » Sentence • Phrase • Word Content • • • • • • White space Separators Comments Identifiers and keywords Data types and literals Comment line arguments I. White spaces • A whitespace is a space, a tab or a new line. • It is used to separate the tokens in a source file and to improve readability • Java don’t require indentation rules – Example: following codes are equivalent package firstpackage; public class SayHello { public static void main(String[] args) { // Display Chao! on the screen ("Chao!"); } } package firstpackage; public class SayHello { public static void main(String[] args) { // Display Chao! on the screen ("Chao!"); .

TÀI LIỆU LIÊN QUAN