SlideShare a Scribd company logo
บทที่ 3 พื้นฐานภาษา Java
Public class Simple{
      Public static void main(String[]args){
             System.out.println(“Programming is
great fun!”);
      }
}
Simple

Simple.java                System.out.println

(;)
                                        public   class




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

         void
                main
print   println

          out               System

 System.out.print(data);
System.out.println(data);
          data
print
println
print       println
       escape sequence

escape sequence
      n          Newline
      t          Horizontal tab
      b          Backspace

      r          Return

                Backslash                
      ’          Single quote             ’
      ”          Double quote             “
2.3
true(     )       false(   )



   char
Unicode                                        ‘‘
                        Unicode
          u



               byte, short, int        long
float      double                  float
                    double
              float        f              F

boolean   1                      true          false
char      2                                              Unicode
byte      1               -128          +127
short     2               -32,768            +32,767
int       4               -2,147,483,648
                          +2,147,483,647
long      8               -2---63         2---63 -
float     4                -        x    -           -      x

double    8                -     x 10-308              -        x
                          10+308
A–Z,a–z,$   _


        .




            final
final                   =           ;
//
                         /*               */
3.                                        /**
         */


              total = const + tax;
     -        Cost = total – tax;         –
              Tax = cost * rate;
              Saleprice =
              original / 2
     %        Ramainder = value
              % 3;
                                          – ,
- (unary
negation)


*/%

+-
=       X = 5;         X = X + 5;
          -=        Y -= 2;       Y = Y – 2;
          *=       Z *= 10;       Z = Z * 10;
          /=        A /= b;       A = A / b;
          %=       C %= 3;        C = C % 3;




               –


y = x++            y          x
-
-




                 Cast Operator

              Cast Operator


x = (int)number;
               number            int
double
                 double
        2.                float

float
        3.
             long
                          long




             String
(   )
   Method
charAt(inde       index
x)
length()
toLowerCas
e()
toUpperCas
e()
Scanner

Scanner keyboard;
                                keyboard
      Scanner
        new
                = new        (             );
                         keyboard

               System.in
keyboard = new Scanner(System.in);
Scanner




nextByte()                       Byte
nextDouble()                 Double


nextFloat()                  Float
nextInt()                        Int
nextLine()
nextLong()               Long
nextShort()              Short
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Java

More Related Content

PDF
Swift - Krzysztof Skarupa
KEY
「Frama-Cによるソースコード検証」 (mzp)
PPTX
F# intro
PDF
PPTX
Wcbpijwbpij new
PDF
All I know about rsc.io/c2go
PDF
Exploring fractals in CSS, @fronttrends, Warsaw, 2015
PDF
Comunicação Bluetooth Entre Python e PyS60
Swift - Krzysztof Skarupa
「Frama-Cによるソースコード検証」 (mzp)
F# intro
Wcbpijwbpij new
All I know about rsc.io/c2go
Exploring fractals in CSS, @fronttrends, Warsaw, 2015
Comunicação Bluetooth Entre Python e PyS60

What's hot (20)

PDF
Metarhia KievJS 22-Feb-2018
PDF
JavaScript - Agora nervoso
PDF
Yahoo! JAPANとKotlin
DOCX
Matlab code for secant method
PDF
[신경망기초]오류역전파알고리즘구현
PDF
Finagle By Twitter Engineer @ Knoldus
PPTX
The groovy puzzlers (as Presented at JavaOne 2014)
PPTX
Hacking Go Compiler Internals / GoCon 2014 Autumn
PDF
[신경망기초] 합성곱신경망
PDF
Taking Inspiration From The Functional World
TXT
Trip itparsing
PDF
Laziness in Swift
PDF
c programming
PDF
Зависимые типы в GHC 8. Максим Талдыкин
PPTX
Intoduction to dynamic memory allocation
PDF
C++ L08-Classes Part1
PDF
Composition in JavaScript
PDF
Generics and Inference
PDF
PFDS 4章をOCamlに翻訳
PDF
Sigma type
Metarhia KievJS 22-Feb-2018
JavaScript - Agora nervoso
Yahoo! JAPANとKotlin
Matlab code for secant method
[신경망기초]오류역전파알고리즘구현
Finagle By Twitter Engineer @ Knoldus
The groovy puzzlers (as Presented at JavaOne 2014)
Hacking Go Compiler Internals / GoCon 2014 Autumn
[신경망기초] 합성곱신경망
Taking Inspiration From The Functional World
Trip itparsing
Laziness in Swift
c programming
Зависимые типы в GHC 8. Максим Талдыкин
Intoduction to dynamic memory allocation
C++ L08-Classes Part1
Composition in JavaScript
Generics and Inference
PFDS 4章をOCamlに翻訳
Sigma type
Ad

Viewers also liked (7)

PDF
#งานย่อย 6 ตั้งคำถาม 5 ข้อ
PDF
ส่งประกวด
PDF
วิจารณ์กลุ่มสอง
PDF
สรุปการประเมินนำเสนอหน้าชั้นเรียนกลุ่ม3
PDF
ข้อสอบ
PDF
#งานย่อย 6 แบบทดสอบ
DOCX
แก้งานย่อย 7
#งานย่อย 6 ตั้งคำถาม 5 ข้อ
ส่งประกวด
วิจารณ์กลุ่มสอง
สรุปการประเมินนำเสนอหน้าชั้นเรียนกลุ่ม3
ข้อสอบ
#งานย่อย 6 แบบทดสอบ
แก้งานย่อย 7
Ad

Similar to บทที่ 3 พื้นฐานภาษา Java (20)

PDF
Java Reference
PDF
変数の型 - Java 演習
PPSX
โปรแกรมภาษาซีเบื้องต้น
PDF
Sam wd programs
PDF
Java%20 programming%20guide%20 %20quick%20reference
PDF
Java%20 programming%20guide%20 %20quick%20reference
PDF
Java cheat sheet
PDF
Java programming guide - quick reference
PDF
Java Programming Guide Quick Reference
PDF
Java%20 programming%20guide%20 %20quick%20reference
PDF
Corejava Online 100
PPTX
บทที่ 2 การเขียนคำสั่งขั้นพื้นฐาน
PDF
OOP Chapter 4: Data Type and Expressions
PDF
Cheat Sheet java
DOCX
รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2
KEY
Why Learn Python?
PPTX
เมธอด ชั้น ม 6 ห้อง 2
KEY
Haskellで学ぶ関数型言語
PDF
java-introduction.pdf
PDF
Java Reference
変数の型 - Java 演習
โปรแกรมภาษาซีเบื้องต้น
Sam wd programs
Java%20 programming%20guide%20 %20quick%20reference
Java%20 programming%20guide%20 %20quick%20reference
Java cheat sheet
Java programming guide - quick reference
Java Programming Guide Quick Reference
Java%20 programming%20guide%20 %20quick%20reference
Corejava Online 100
บทที่ 2 การเขียนคำสั่งขั้นพื้นฐาน
OOP Chapter 4: Data Type and Expressions
Cheat Sheet java
รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2
Why Learn Python?
เมธอด ชั้น ม 6 ห้อง 2
Haskellで学ぶ関数型言語
java-introduction.pdf

บทที่ 3 พื้นฐานภาษา Java

  • 2. Public class Simple{ Public static void main(String[]args){ System.out.println(“Programming is great fun!”); } }
  • 3. Simple Simple.java System.out.println (;) public class public static void main(String[]args)
  • 4. main public static void main
  • 5. print println out System System.out.print(data); System.out.println(data); data print println
  • 6. print println escape sequence escape sequence n Newline t Horizontal tab b Backspace r Return Backslash ’ Single quote ’ ” Double quote “
  • 7. 2.3
  • 8. true( ) false( ) char Unicode ‘‘ Unicode u byte, short, int long
  • 9. float double float double float f F boolean 1 true false char 2 Unicode byte 1 -128 +127 short 2 -32,768 +32,767 int 4 -2,147,483,648 +2,147,483,647 long 8 -2---63 2---63 - float 4 - x - - x double 8 - x 10-308 - x 10+308
  • 10. A–Z,a–z,$ _ . final final = ;
  • 11. // /* */ 3. /** */ total = const + tax; - Cost = total – tax; – Tax = cost * rate; Saleprice = original / 2 % Ramainder = value % 3; – ,
  • 13. = X = 5; X = X + 5; -= Y -= 2; Y = Y – 2; *= Z *= 10; Z = Z * 10; /= A /= b; A = A / b; %= C %= 3; C = C % 3; – y = x++ y x
  • 14. - - Cast Operator Cast Operator x = (int)number; number int
  • 15. double double 2. float float 3. long long String
  • 16. ( ) Method charAt(inde index x) length() toLowerCas e() toUpperCas e()
  • 17. Scanner Scanner keyboard; keyboard Scanner new = new ( ); keyboard System.in keyboard = new Scanner(System.in);
  • 18. Scanner nextByte() Byte nextDouble() Double nextFloat() Float nextInt() Int nextLine() nextLong() Long nextShort() Short