1. Trang chủ
  2. » Kỹ Năng Mềm

01 introduction java exception

10 323 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 511,5 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Le Hong Hai UET-VNUH Java Introduction... a syntax similar to C  Structured around objects and methods  A method is an action or something you do with the object C++:  Operator overl

Trang 1

Le Hong Hai UET-VNUH

Java Introduction

Trang 2

a syntax similar to C

 Structured around objects and methods

 A method is an action or something you do

with the object

C++:

 Operator overloading, pointer, templates,

friend class, etc

Trang 3

Java Interpreter

Just in Time Compiler

Runtime System

Class Loader

Java Class Libraries

Operating System

Hardware

Java Virtual machine

How it works…!

Compile-time

Java Bytecodes move locally

or through network

Java Source

(.java)

Java Compiler

Java Bytecod

e (.class )

3

Trang 4

Getting and using java

 JDK freely download from http://www.oracle.com

 All text editors support java

 Eclipse IDE

 http://www.eclipse.org

Trang 5

Compile and run an

application

 Write java class HolaWorld containing a main() method and save

in file ”HolaWorld.java”

 The file name MUST be the same as class name

 Compile with: javac HolaWorld.java

Creates compiled class file: HolaWorld.class

Run the program: java HolaWorld

 Notice: use the class name directly, no class!

5

Trang 6

Hola World!

/* Our first Java program – HolaWorld.java */

public class HolaWorld {

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

System.out.println( ”Hola world!" );

} }

File name: HolaWorld.java

Command line arguments

Standard output, print with new line

Trang 7

HolaWorld in Eclipse - create a

new project

 File > New > Java Project

 Project Name : HolaWorld

7

Trang 8

HolaWorld in Eclipse – add a

new class

 File > New > Class

 source folder :

HolaWorld/src

 Package : ucab.test

 Name : HolaWorld

 check "public static void

main (String[] args)

Trang 9

HolaWorld in Eclipse – write

your code

 Add your code

System.out.println(“Hola world!”);

9

Trang 10

HolaWorld in Eclipse – run

your program

 Run > Run As > Java Application

Ngày đăng: 12/09/2014, 16:16

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN

w