1 / 27

Item : 1. RM 4.50 2. 7 ekor lembu 3. π = 22/7 = 3.1415...... 4. 0 = false, 1=true

Item : 1. RM 4.50 2. 7 ekor lembu 3. π = 22/7 = 3.1415...... 4. 0 = false, 1=true. Nilai mata wang Nilai bilangan Nilai dalam bentuk angka perpuluhan Nilai dalam takrifan komputer. 6.2.1 Data Types. Definisi : “the type of value to be stored in the memory”

salome
Download Presentation

Item : 1. RM 4.50 2. 7 ekor lembu 3. π = 22/7 = 3.1415...... 4. 0 = false, 1=true

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Item:1. RM 4.502. 7ekorlembu3. π = 22/7 = 3.1415......4. 0= false, 1=true Nilaimatawang Nilaibilangan Nilaidalambentukangkaperpuluhan Nilaidalamtakrifankomputer

  2. 6.2.1 Data Types • Definisi: • “the type of value to be stored in the memory” • “jenisnilai yang akandisimpandalam memory” • Data types

  3. 6.2.1 Data Types • Definisi: • “the typeofvalue to be stored in the memory” • “jenisnilaiyang akandisimpandalammemory” • Data types

  4. Data type, Storage Size and Range

  5. Exercise • Data type ____ hanyamempunyai 8 bits memori. • Data type Short mempunyai ___ bytes memori. • Data type___ mengandungihanya 2 kemungkinannilai, iaitu ___ dan ___. • Data type___ dan ___ mengandungi 4 bytesmemori.

  6. Exercise • Data type bytehanyamempunyai 8 bits memori. • Data type Short mempunyai2 bytes memori. • Data typeBooleanmengandungihanya 2 kemungkinannilai, iaitu0dan1. • Data typeintdanfloatmengandungi 4 bytesmemori.

  7. 6.2.2 Variable y=mx+c Contoh: y= 2x+9, x=5: y=? Paksi Y y=mx+c C Kesimpulan: x ialahvariablebagi y dan y ialahvariablebagi x Paksi X “Keranasetiapnilai x akan memberikepadanilai y danjugasebaliknya” x dan y jugadikenali sebagai variable

  8. 6.2.2 Variable • Dalam java, Variable ialahsatunama yang diladelkanuntukmenyimpannilaipadamemori Rules for naming Variable: An identifier must start with character (A-z), (_) or ($) The rest of the letter in an identifier an be of any character except those used as operators in Java (+,-,or *) Special character such as #,!,@ and ^ can't be used. Blank and tab space can't be used Java is case sensitive (Student!=student) Keywords listed in Java can't be used as identifiers Dari padacontohtadi x adalah variable kepadapersamaantadi (y=2x+9)

  9. Example :

  10. Example :

  11. Example :

  12. Example :

  13. Example :

  14. Example :

  15. Example :

  16. Example :

  17. Example :

  18. Example :

  19. Pengistiharan (declaration) <data type><variable>; Contoh: intjum_pel; • Umpukan (initializing) <data type><variable>=<nilai>; Contoh: doublehargaseunit=2.40;

  20. Exercise • Berikanapa yang dimaksudkandengan Variable? • “satunama yang dilabelkanuntukmenyimpannilaipadamemori” • Apakah variable berikutsahsebagai variable dalam Java? Second! bite the cake 1st name Tidaksah Bubble sah

  21. Exercise • Apakah variable berikutsahsebagai variable dalam Java? Berikansebab variable itusahatautidak Second! bite the cake 1st name Tidaksah Bubble sah bite the cake : variable tidakbolehterpisaholeh spacebar Second! : Tandaserutidakbolehdigunakan 1st name : Variable tidakbolehdimulakandengannombor dantidakbolehmengandungi spacebar

  22. 6.2.3 Keywords • Defination: “Keyword are reserved words available in Java language” • Definisi:“Keyword ialahperkataan-perkataankhas yang digunakandalamPengaturcaraan Java” • Setiap Keywords mempunyaifungsi yang tersendiridalambahasapengaturcaraan Java. • Olehituiadilaranguntukdigunakansebagai identifier.

  23. 6.2.3 Keywords

  24. Exercise • Berikanmaksud keywords? • Keyword ialahperkataan-perkataankhas yang digunakandalamPengaturcaraan Java • Antaraberikutmanakahdisenaraikandalam keyword • Tuliskansatupengistiharan (declaration) bilangankeretaadalahsifar. intbil_kereta=0; Byte for goto variable good void

  25. Exercise • Berikan 10 keywords yang andatahubesertajenis keywords

  26. Answers • Berikan 10 keywords yang andatahubesertajenis keywords KEYWORDS TYPES class, cast, instance of, void, synchronized User-defined data types and type related if, else, switch, case, default Conditional For, while, do, break, continue, goto and return Flow control Catch, finally, try, throw, throws Exception handling Abstract, Boolean, byte, char, double, extends, final, Data types, modifiers, class and access specifiers

  27. Definition:“the type of value to be stored in the memory” Rules for naming Variable: An identifier must start with character (A-z), (_) or ($) The rest of the letter in an identifier an be of any character except those used as operators in Java (+,-,or *) Special character such as #,!,@ and ^ can't be used. Blank and tab space can't be used Java is case sensitive (Student!=student) Keywords listed in Java can't be used as identifiers Definition: “the name given to the memory location where a value is stored” Data Type Variable 6.2 Variable, Data types, and Operators kesimpulan Keywords intbil_kereta=0; Definition:“A reserved words that available in “Java Language" and each of the keywords are prefined”

More Related