งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

Java Programming Language สาขาวิชาระบบสารสนเทศ คณะบริหารธุรกิจ มหาวิทยาลัยเทคโนโลยีราชมงคลกรุงเทพ.

งานนำเสนอที่คล้ายกัน


งานนำเสนอเรื่อง: "Java Programming Language สาขาวิชาระบบสารสนเทศ คณะบริหารธุรกิจ มหาวิทยาลัยเทคโนโลยีราชมงคลกรุงเทพ."— ใบสำเนางานนำเสนอ:

1 Java Programming Language สาขาวิชาระบบสารสนเทศ คณะบริหารธุรกิจ มหาวิทยาลัยเทคโนโลยีราชมงคลกรุงเทพ

2 Class Outline Class/Attention 10 point Midterm 35 point Final 35 point Work Class & H/W 20 poin

3 Topic Class Object Method Control Exception String Class & Math Class Inheritance Swing Set & JDBC

4 การติดตั้งโปรแกรม ดาวน์โหลดโปรแกรมภาษาจาวา jdk- 1_5_0_03-windows-i586-p.exe ที่ www.java.sun.com เพื่อทำการติดตั้ง โปรแกรม www.java.sun.com ดาวน์โหลดคู่มือภาษาจาวาโปรแกรม jdk- 1_5_0-doc.zip ที่ www.java.sun.com เพื่อ ติดตั้งคู่มือโปรแกรมwww.java.sun.com ติดตั้งโปรแกรมภาษาจาวา jdk-1_5_0_03 ติดตั้งคู่มือโปรแกรมภาษาจาวา jdk-1_5_0_03- doc

5 Config Path Program กำหนด Path เพื่อใช้งานโปรแกรม กรณี win98 ให้แก้ไขไฟล์ Autoexec.bat ดังนี้ set path = C:\Program Files\Java\jdk1.5.0_03 กรณี winxp – คลิกขวา my computer > properties – แท็ป Advance > Environment Variable – ที่ System variables แก้ไข path เหมือน win98 path = C:\Program Files\Java\jdk1.5.0_03

6 Test Program Java Application เขียนโปรแกรมและบันทึกไฟล์ให้มีนามสกุล. java ทำการคอมไพล์โปรแกรม c:\javac filename.java  จะได้ไฟล์ที่มีชื่อตามชื่อคลาส ทำการรันโปรแกรม c:\java filename 

7 //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } Trace a Program Execution Enter main method animation

8 //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } Trace a Program Execution Execute statement animation

9 //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); } Trace a Program Execution animation print a message to the console

10 NetBeans5.0 Setup Program NetBeans5.0 Test Program NetBeans5.0 show… System.out.println(“Hello World”); JOptionPane.showMessageDialog(null,”Hello World”);

11 Displaying Text in a Message Dialog Box you can use the showMessageDialog method in the JOptionPane class. JOptionPane is one of the many predefined classes in the Java system, which can be reused rather than “reinventing the wheel.”

12 The showMessageDialog Method JOptionPane.showMessageDialog(null, "Welcome to Java!", “Display Message", JOptionPane.INFORMATION_MESSAGE));

13 Two Ways to Invoke the Method There are several ways to use the showMessageDialog method. For the time being, all you need to know are two ways to invoke it. One is to use a statement as shown in the example: JOptionPane.showMessageDialog(null, x, y, JOptionPane.INFORMATION_MESSAGE)); where x is a string for the text to be displayed, and y is a string for the title of the message dialog box. The other is to use a statement like this: JOptionPane.showMessageDialog(null, x); where x is a string for the text to be displayed.

14 Anatomy of a Java Program Comments Package Reserved words Modifiers Statements Blocks Classes Methods The main method

15 Object Oriented Concept OOP เป็นการเขียนโปรแกรมที่ประกอบไปด้วย กลุ่มของ Object Object สามารถสร้างได้จาก Class – รูปแบบ Classname Objectanme = new Constructorname(); การเรียงใช้ Attribute หรือ Behavior กระทำได้ผ่านชื่อ Object –Objectname.method หรือ Objectname.Variable Class ประกอบด้วย – คุณลักษณะ (Attribute) – พฤติกรรม (Behavior) – สามารถถ่ายทอดลักษณะ (Inheritance) ได้

16 Example Class Car String name String type int Wheel String Color Engine (int cc)

17 Create Class Program Java import java.lang.*; class Car{ static String name; static String type; static int wheel; static String color; private int eng; Car(){ wheel = 0; color = null; eng = 0; } static void engine (int cc){ eng = cc; } import java.lang.*; class TestCar{ public static void main(String args[]){ Car car1 = new Car(); car1.name=“Toyota”; car1.type=“F1” car1.wheel=4; car1.color=“red”; car1.engine(3000); }


ดาวน์โหลด ppt Java Programming Language สาขาวิชาระบบสารสนเทศ คณะบริหารธุรกิจ มหาวิทยาลัยเทคโนโลยีราชมงคลกรุงเทพ.

งานนำเสนอที่คล้ายกัน


Ads by Google