SlideShare una empresa de Scribd logo
1 de 43
method
Method


Function

Method
     Method   Java
Class          Class      Method
Class     Class    public
main Method
Method modifiers
                    public static
Return_ Type

                                    void
MethodName
parameter
                   (;)
reture
(Type of Method)

1.   Static Method -
2.   Instance Method -
3.   Constructor Method -
4.   Overloading Method -

5. Overriding Method -

1. Static Method
          static



                    method(argument);
2. Instance Method




object.method(argument);
object.attribute
3. Constructor Method



                      constructor

    void
Class object = new Class();
4. Overloading Method

                    overload constructor)

Overloading Method
public int Print(int idbook){...}
public String Print(int bookname){...}
Overloading Constructor
public Circle() {...}
public Circle(int radius) {...}
Output            Student
5. Overriding Method




                            Inheritance)

class Person {
  public void print() {System.out.print("People");}
}

class Student extend Person {
  public void print() {System.out.print("Student");}
}
main()

static




                     displayMessage()


         SimpleMethod.java
main
hierarchical
        A       B
    B       C
                C   JVM
            B   JVK
A
DeepAndDeeper.java
Math



       void
sqfrt
            16
              4




                   area



           Math      API




Math.pow
Math .pow
                 double


           4.0       2.0
       3         6         3
4.0         2.0
    3         6            3




Math.sqrt
                        doble




                  3.0
Math.random

         0    1
MathDemo.java
     Math




                Random
                    0.0   1.0
                                10
TenRandomNumber.java
          10




     1   6
random
   r



  r      0.0      1.0
            6.0
           1.0      7.0
(argument)
                          (parameter)
      parameter_list



            PrintCharLine
            PrintLine
                    c
char         len         int
        c

len
1: using System;
2: class ParamNoRet {
3:     static void PrintCharLine(char c, int len)
{
4:           for (int i = 0; i < len; i++)
5:                 Console.Write(c);
6:                 Console.WriteLine();
7:     }
8:
9:     static void Main() {
10:            PrintCharLine(’o’, 10);
11:           PrintCharLine(’x’, 20);
12:      }
13: }
PrintCharLine                       Main
       10                'o'      10
PrintCharLine
       c      len
       4    5
   o                            10
                               PrintCharLine
       11                                  x
                    20
4.4
             showSum


      void
                          return


                showSum
total   double
3     4
showSum




          return

                   Add
=                -32 1.8




double
         double
(true)   (false)
boolean


                             1   100
main                              main
                   4.8
             4.8                    f(x)
= x2 5   x               0   10
return
4.9

              2   1

isPrime

return    5
6317   7163
4.5         Local

                         (local variable)




                         4.10
         main()
      Phuket    rayong
                      birds
              4.10LocalVars.java
4.10
4.11
x        main               x
             one()              x
               main
    x    one
    x   main
          4.11Local2.java
4.6           (Overloading Method)




                          (Overload
Method)
             4.12
          4.12
4.13 CalGrade.java




   75
4.14 BarChart.java
                         Bar

*
24
1
     28
2.
     29
3.
     32
4.
     33
5.
     34
6.

Más contenido relacionado

La actualidad más candente

The Ring programming language version 1.5.1 book - Part 30 of 180
The Ring programming language version 1.5.1 book - Part 30 of 180The Ring programming language version 1.5.1 book - Part 30 of 180
The Ring programming language version 1.5.1 book - Part 30 of 180Mahmoud Samir Fayed
 
Python Programming: Data Structure
Python Programming: Data StructurePython Programming: Data Structure
Python Programming: Data StructureChan Shik Lim
 
Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?Adam Dudczak
 
The... Wonderful? World of Lambdas
The... Wonderful? World of LambdasThe... Wonderful? World of Lambdas
The... Wonderful? World of LambdasEsther Lozano
 
Lambda выражения и Java 8
Lambda выражения и Java 8Lambda выражения и Java 8
Lambda выражения и Java 8Alex Tumanoff
 
Functors, applicatives, monads
Functors, applicatives, monadsFunctors, applicatives, monads
Functors, applicatives, monadsrkaippully
 
Introduction to functional programming using Ocaml
Introduction to functional programming using OcamlIntroduction to functional programming using Ocaml
Introduction to functional programming using Ocamlpramode_ce
 
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardJava 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardMario Fusco
 
Collection frame work
Collection  frame workCollection  frame work
Collection frame workRahul Kolluri
 
Tuga IT 2017 - What's new in C# 7
Tuga IT 2017 - What's new in C# 7Tuga IT 2017 - What's new in C# 7
Tuga IT 2017 - What's new in C# 7Paulo Morgado
 
Python 2.5 reference card (2009)
Python 2.5 reference card (2009)Python 2.5 reference card (2009)
Python 2.5 reference card (2009)gekiaruj
 

La actualidad más candente (20)

Talk Code
Talk CodeTalk Code
Talk Code
 
Beginning Python
Beginning PythonBeginning Python
Beginning Python
 
The Ring programming language version 1.5.1 book - Part 30 of 180
The Ring programming language version 1.5.1 book - Part 30 of 180The Ring programming language version 1.5.1 book - Part 30 of 180
The Ring programming language version 1.5.1 book - Part 30 of 180
 
Java Class Design
Java Class DesignJava Class Design
Java Class Design
 
Python Programming: Data Structure
Python Programming: Data StructurePython Programming: Data Structure
Python Programming: Data Structure
 
Lrz kurse: r as superglue
Lrz kurse: r as superglueLrz kurse: r as superglue
Lrz kurse: r as superglue
 
Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?
 
The... Wonderful? World of Lambdas
The... Wonderful? World of LambdasThe... Wonderful? World of Lambdas
The... Wonderful? World of Lambdas
 
Lambda выражения и Java 8
Lambda выражения и Java 8Lambda выражения и Java 8
Lambda выражения и Java 8
 
Python Cheat Sheet
Python Cheat SheetPython Cheat Sheet
Python Cheat Sheet
 
Functors, applicatives, monads
Functors, applicatives, monadsFunctors, applicatives, monads
Functors, applicatives, monads
 
Introduction to functional programming using Ocaml
Introduction to functional programming using OcamlIntroduction to functional programming using Ocaml
Introduction to functional programming using Ocaml
 
Java 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forwardJava 7, 8 & 9 - Moving the language forward
Java 7, 8 & 9 - Moving the language forward
 
OOP Core Concept
OOP Core ConceptOOP Core Concept
OOP Core Concept
 
Collection frame work
Collection  frame workCollection  frame work
Collection frame work
 
Tuga IT 2017 - What's new in C# 7
Tuga IT 2017 - What's new in C# 7Tuga IT 2017 - What's new in C# 7
Tuga IT 2017 - What's new in C# 7
 
Python 2.5 reference card (2009)
Python 2.5 reference card (2009)Python 2.5 reference card (2009)
Python 2.5 reference card (2009)
 
Templates
TemplatesTemplates
Templates
 
Fun with functions
Fun with functionsFun with functions
Fun with functions
 
Java Generics - by Example
Java Generics - by ExampleJava Generics - by Example
Java Generics - by Example
 

Destacado

ยีนและโครโมโซม
ยีนและโครโมโซมยีนและโครโมโซม
ยีนและโครโมโซมComputer ITSWKJ
 
หน่วยที่1ชายหาด
หน่วยที่1ชายหาดหน่วยที่1ชายหาด
หน่วยที่1ชายหาดWan Ngamwongwan
 
หน่วยที่2สิ่งมีชีวิตและการดำรงชีวิตบริเวณชายหาด
หน่วยที่2สิ่งมีชีวิตและการดำรงชีวิตบริเวณชายหาดหน่วยที่2สิ่งมีชีวิตและการดำรงชีวิตบริเวณชายหาด
หน่วยที่2สิ่งมีชีวิตและการดำรงชีวิตบริเวณชายหาดWan Ngamwongwan
 
เฉลยแบบฝึกหัด17.5โครงสร้างdna
เฉลยแบบฝึกหัด17.5โครงสร้างdnaเฉลยแบบฝึกหัด17.5โครงสร้างdna
เฉลยแบบฝึกหัด17.5โครงสร้างdnaWan Ngamwongwan
 
รณรงค์งดสูบบุหรี่
รณรงค์งดสูบบุหรี่รณรงค์งดสูบบุหรี่
รณรงค์งดสูบบุหรี่Wan Ngamwongwan
 
สราวุฒิ-รณรงค์เลิกบุหรี่
สราวุฒิ-รณรงค์เลิกบุหรี่สราวุฒิ-รณรงค์เลิกบุหรี่
สราวุฒิ-รณรงค์เลิกบุหรี่Wan Ngamwongwan
 
ค่าพลังงานในอาหาร Ebook
ค่าพลังงานในอาหาร Ebookค่าพลังงานในอาหาร Ebook
ค่าพลังงานในอาหาร EbookWan Ngamwongwan
 
3การแลกเปลี่ยนแก๊ส
3การแลกเปลี่ยนแก๊ส3การแลกเปลี่ยนแก๊ส
3การแลกเปลี่ยนแก๊สWan Ngamwongwan
 
dnaกับลักษณะทางพันธุกรรมม.5
 dnaกับลักษณะทางพันธุกรรมม.5 dnaกับลักษณะทางพันธุกรรมม.5
dnaกับลักษณะทางพันธุกรรมม.5Wan Ngamwongwan
 
เฉลยแบบฝึกหัดเรื่องฮอร์โมน
เฉลยแบบฝึกหัดเรื่องฮอร์โมนเฉลยแบบฝึกหัดเรื่องฮอร์โมน
เฉลยแบบฝึกหัดเรื่องฮอร์โมนWan Ngamwongwan
 
ต่อมไร้ท่อ
ต่อมไร้ท่อต่อมไร้ท่อ
ต่อมไร้ท่อWan Ngamwongwan
 
ตัวอย่างโครงการสอน
ตัวอย่างโครงการสอนตัวอย่างโครงการสอน
ตัวอย่างโครงการสอนKrupol Phato
 
เฉลยชีววิทยาหน้า52- 59
เฉลยชีววิทยาหน้า52- 59เฉลยชีววิทยาหน้า52- 59
เฉลยชีววิทยาหน้า52- 59Wan Ngamwongwan
 
รวมเล่มโครงการสอน
รวมเล่มโครงการสอนรวมเล่มโครงการสอน
รวมเล่มโครงการสอนWichai Likitponrak
 

Destacado (15)

ยีนและโครโมโซม
ยีนและโครโมโซมยีนและโครโมโซม
ยีนและโครโมโซม
 
หน่วยที่1ชายหาด
หน่วยที่1ชายหาดหน่วยที่1ชายหาด
หน่วยที่1ชายหาด
 
หน่วยที่2สิ่งมีชีวิตและการดำรงชีวิตบริเวณชายหาด
หน่วยที่2สิ่งมีชีวิตและการดำรงชีวิตบริเวณชายหาดหน่วยที่2สิ่งมีชีวิตและการดำรงชีวิตบริเวณชายหาด
หน่วยที่2สิ่งมีชีวิตและการดำรงชีวิตบริเวณชายหาด
 
เฉลยแบบฝึกหัด17.5โครงสร้างdna
เฉลยแบบฝึกหัด17.5โครงสร้างdnaเฉลยแบบฝึกหัด17.5โครงสร้างdna
เฉลยแบบฝึกหัด17.5โครงสร้างdna
 
รณรงค์งดสูบบุหรี่
รณรงค์งดสูบบุหรี่รณรงค์งดสูบบุหรี่
รณรงค์งดสูบบุหรี่
 
สราวุฒิ-รณรงค์เลิกบุหรี่
สราวุฒิ-รณรงค์เลิกบุหรี่สราวุฒิ-รณรงค์เลิกบุหรี่
สราวุฒิ-รณรงค์เลิกบุหรี่
 
ค่าพลังงานในอาหาร Ebook
ค่าพลังงานในอาหาร Ebookค่าพลังงานในอาหาร Ebook
ค่าพลังงานในอาหาร Ebook
 
3การแลกเปลี่ยนแก๊ส
3การแลกเปลี่ยนแก๊ส3การแลกเปลี่ยนแก๊ส
3การแลกเปลี่ยนแก๊ส
 
dnaกับลักษณะทางพันธุกรรมม.5
 dnaกับลักษณะทางพันธุกรรมม.5 dnaกับลักษณะทางพันธุกรรมม.5
dnaกับลักษณะทางพันธุกรรมม.5
 
เฉลยแบบฝึกหัดเรื่องฮอร์โมน
เฉลยแบบฝึกหัดเรื่องฮอร์โมนเฉลยแบบฝึกหัดเรื่องฮอร์โมน
เฉลยแบบฝึกหัดเรื่องฮอร์โมน
 
ต่อมไร้ท่อ
ต่อมไร้ท่อต่อมไร้ท่อ
ต่อมไร้ท่อ
 
ตัวอย่างโครงการสอน
ตัวอย่างโครงการสอนตัวอย่างโครงการสอน
ตัวอย่างโครงการสอน
 
เฉลยชีววิทยาหน้า52- 59
เฉลยชีววิทยาหน้า52- 59เฉลยชีววิทยาหน้า52- 59
เฉลยชีววิทยาหน้า52- 59
 
รวมเล่มโครงการสอน
รวมเล่มโครงการสอนรวมเล่มโครงการสอน
รวมเล่มโครงการสอน
 
14แบบทดสอบสารพันธุกรรม
14แบบทดสอบสารพันธุกรรม14แบบทดสอบสารพันธุกรรม
14แบบทดสอบสารพันธุกรรม
 

Similar a เมธอด ชั้น ม 6 ห้อง 2

Java Questions
Java QuestionsJava Questions
Java Questionsbindur87
 
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdfLECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdfShashikantSathe3
 
JavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for DummiesJavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for DummiesCharles Nutter
 
Notes for xx_use_serialgc
Notes for xx_use_serialgcNotes for xx_use_serialgc
Notes for xx_use_serialgcytoshima
 
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...Charles Nutter
 
Java Performance Puzzlers
Java Performance PuzzlersJava Performance Puzzlers
Java Performance PuzzlersDoug Hawkins
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesGanesh Samarthyam
 
C++aptitude questions and answers
C++aptitude questions and answersC++aptitude questions and answers
C++aptitude questions and answerssheibansari
 
Java 7 at SoftShake 2011
Java 7 at SoftShake 2011Java 7 at SoftShake 2011
Java 7 at SoftShake 2011julien.ponge
 
Introduction to Monads in Scala (1)
Introduction to Monads in Scala (1)Introduction to Monads in Scala (1)
Introduction to Monads in Scala (1)stasimus
 
Java 7 JUG Summer Camp
Java 7 JUG Summer CampJava 7 JUG Summer Camp
Java 7 JUG Summer Campjulien.ponge
 
JavaOne 2016 - Learn Lambda and functional programming
JavaOne 2016 - Learn Lambda and functional programmingJavaOne 2016 - Learn Lambda and functional programming
JavaOne 2016 - Learn Lambda and functional programmingHenri Tremblay
 
Parallel and Async Programming With C#
Parallel and Async Programming With C#Parallel and Async Programming With C#
Parallel and Async Programming With C#Rainer Stropek
 

Similar a เมธอด ชั้น ม 6 ห้อง 2 (20)

Java
JavaJava
Java
 
Java Questions
Java QuestionsJava Questions
Java Questions
 
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdfLECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
 
JavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for DummiesJavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for Dummies
 
Notes for xx_use_serialgc
Notes for xx_use_serialgcNotes for xx_use_serialgc
Notes for xx_use_serialgc
 
Scala ntnu
Scala ntnuScala ntnu
Scala ntnu
 
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
 
Java Performance Puzzlers
Java Performance PuzzlersJava Performance Puzzlers
Java Performance Puzzlers
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
 
Java Class Design
Java Class DesignJava Class Design
Java Class Design
 
Android and cpp
Android and cppAndroid and cpp
Android and cpp
 
C++aptitude questions and answers
C++aptitude questions and answersC++aptitude questions and answers
C++aptitude questions and answers
 
Java 7 LavaJUG
Java 7 LavaJUGJava 7 LavaJUG
Java 7 LavaJUG
 
DITEC - Programming with Java
DITEC - Programming with JavaDITEC - Programming with Java
DITEC - Programming with Java
 
Java 7 at SoftShake 2011
Java 7 at SoftShake 2011Java 7 at SoftShake 2011
Java 7 at SoftShake 2011
 
Introduction to Monads in Scala (1)
Introduction to Monads in Scala (1)Introduction to Monads in Scala (1)
Introduction to Monads in Scala (1)
 
Java 7 JUG Summer Camp
Java 7 JUG Summer CampJava 7 JUG Summer Camp
Java 7 JUG Summer Camp
 
JAVA SE 7
JAVA SE 7JAVA SE 7
JAVA SE 7
 
JavaOne 2016 - Learn Lambda and functional programming
JavaOne 2016 - Learn Lambda and functional programmingJavaOne 2016 - Learn Lambda and functional programming
JavaOne 2016 - Learn Lambda and functional programming
 
Parallel and Async Programming With C#
Parallel and Async Programming With C#Parallel and Async Programming With C#
Parallel and Async Programming With C#
 

Más de Pookie Pook

ข่าว It sms ครบรอบ 20 ปี วิจัยชี้ยังโตได้อีก
ข่าว It sms ครบรอบ 20 ปี วิจัยชี้ยังโตได้อีกข่าว It sms ครบรอบ 20 ปี วิจัยชี้ยังโตได้อีก
ข่าว It sms ครบรอบ 20 ปี วิจัยชี้ยังโตได้อีกPookie Pook
 
การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2
การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2
การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2Pookie Pook
 
การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2
การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2
การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2Pookie Pook
 
รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2
รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2
รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2Pookie Pook
 

Más de Pookie Pook (6)

It news
It news It news
It news
 
Power point
Power pointPower point
Power point
 
ข่าว It sms ครบรอบ 20 ปี วิจัยชี้ยังโตได้อีก
ข่าว It sms ครบรอบ 20 ปี วิจัยชี้ยังโตได้อีกข่าว It sms ครบรอบ 20 ปี วิจัยชี้ยังโตได้อีก
ข่าว It sms ครบรอบ 20 ปี วิจัยชี้ยังโตได้อีก
 
การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2
การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2
การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2
 
การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2
การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2
การเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม.6 ห้อง2
 
รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2
รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2
รายงานการเขียนคำสั่งควบคุมแบบวนซ้ำ กลุ่ม 4 ม. 6 ห้อง2
 

เมธอด ชั้น ม 6 ห้อง 2