Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
OOPObject-Oriented Programming        state        BehaviorI       dentity
AccessSpecifier] Class Name        {                  Members        }AccessSpecifierclassNameMembers ClassName ObjectName...
static)                                                         new                    import java.util.Scanner;          ...
Constructors                               new                               Constructors                                 ...
Student.Javapublic class Student3 {private String name;private String email;              public Student3(){              ...
-                  -shiftA        CB        D………………..Y       AZ       B                       DIZZY”                - shif...
New>Class3.   Next4.
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
Upcoming SlideShare
Loading in …5
×

คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น

340 views

Published on

  • Be the first to comment

  • Be the first to like this

คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น

  1. 1. OOPObject-Oriented Programming state BehaviorI dentity
  2. 2. AccessSpecifier] Class Name { Members }AccessSpecifierclassNameMembers ClassName ObjectName; ObjectName newobjecyName = new ClassName([arguments]) accessSpecifier
  3. 3. static) new import java.util.Scanner; public class Cal_Max { public static void main(String args[]) { int num1,num2; Scanner stdin = new Scanner(System.in); System.out.print("Input Number 1 : "); num1 = stdin.nextInt(); System.out.print("Input Number 2 : "); num2 = stdin.nextInt(); int larger = TestMax.max(num1,num2); System.out.println("Max Data is "+larger); } } class TestMax { static int max(int num1, int num2) { if(num1 > num2) return num1; else return num2; } } Scanner max TestMax
  4. 4. Constructors new Constructors constructor constructure base class ( php class Auto_Cart extends Cart { function Auto_Cart() { $this->add_item("10", 1); } } ?> Constructors function php class Constructor_Cart extends Cart { function Constructor_Cart( $item = "10", $num = 1) { $this->add_item($item, $num); } }// Constructor function $default_cart = newConstructor_Cart; // Constructor Constructor_Cart default error// parameter different_cart = new Constructor_Cart("20", 17); ?>
  5. 5. Student.Javapublic class Student3 {private String name;private String email; public Student3(){ name = "Unassigned"; email = "Unassigned"; } public String getEmail(){ return email; } public String getName(){ return name; } public void setEmail(String address){ email = address; } public void setName(String studentName){ name = studentName; }}
  6. 6. - -shiftA CB D………………..Y AZ B DIZZY” - shift FKBBA” Teerawut message Teerawut”2. shift encrypt msg message shift encrypt encryptedMessage msg encryptedMessage
  7. 7. New>Class3. Next4.

×