SlideShare a Scribd company logo
1 of 17
Download to read offline
Java
Class
• Class names should be nouns, in mixed case
• with the first letter of each internal word
capitalized.
• Try to keep your class names simple
• and descriptive. Use whole words—avoid
• acronyms and abbreviations
• Eg helloWorld,HelloWorld
Methods
• Methods should be verbs, in mixed case with
the first letter lowercase, with the first letter of
each internal word capitalized.
• run();
• runFast();
• getBackground();
Variables
• Except for variables, all instance, class, and
• class constants are in mixed case with a
lowercase
• first letter. Internal words start with capital
• letters.
• Variable names should be short yet meaningful.
• The choice of a variable name should be
mnemonic— that is, designed to indicate to the
use.
• int I;
• char
Basic Program
• class helloWorld
• {
• public static void main(String args[ ])
• {
• System.out.println(“Hello World!”);
• }
• }
Class Identification
• The class definition
• The first line is a declaration statement to
introduce the code to the computer before it
is used:
• class notifies the interpreter that a new class
will be defined.
• helloWorld is the unique name for this new
class.
• The curly braces signal the beginning and end
of the class body
The main method
• Atleast one and only one main method.
• Java applets, however, do not contain main methods.
• public is known as a 'global', a signal to the interpreter that this method
can be used in other parts of the program.
• The private keyword prevents the rest of the program from calling
anything inside a method.
• static tells the interpreter that the main method applies to everything
in the helloWorld class, rather than just one element. Breathing and
daily activities work as analogies for static and instance methods; daily
activities vary but breathing is required.
• void indicates that this method finishes operating without returning any
results.
• main is the unique identifier for this method and is a reserved word
because all Java applications have one and only one main method.
• The parentheses indicate that parameters can be passed to this method
main(String args[ ])
• The String array
• The third line declares an array, an element
that stores a list of values like x[1,2,3].
Contrast arrays with variables that store only
one value at a time, like x=3. String defines
the type of values received: numbers,
characters, and symbols. Args is the unique
name for this array, and the brackets signal its
array status.
System class & output
• System is a class in Java's default package and
handles system hardware.
• Out is an object of that class and handles
output.
• Println() is a method of System and accepts
Hello, world! as a parameter to output to the
screen.
• Interpreters normally ignore spaces in stored
values, so quotation marks declare this a
string parameter to preserve such characters.
Java Comments
• The Java programming language supports three kinds
of comments:
1. Double slashes in front of a single line comment:
int i=5; // Set the integer to 5
2. Matching slash-asterisk (/*) and asterisk-slash (*/) to bracket multi-line
comments:
/*
Set the integer to 5
*/
int i=5;
3. Matching slash-double asterisk (/**) & asterisk-slash(*/) for Javadoc automatic
hypertext documentation, as in
/**
This applet tests graphics.
Java Data and Variables
• byte
• Short
• int
• long
• float
• Double
• char
• boolean
Java Data and Variables
• Integer types have no fractional part; floating
point types have a fractional part. On paper,
integers have no decimal point, and floating
point types do. But in main memory, there are
no decimal points: even floating point values
are represented with bit patterns. There is a
fundamental difference between the method
used to represent integers and the method
used to represent floating point numbers.
Java Data and Variables
• Type Size
• byte ……….8 bits
• Short……… 16 bits
• int …………..32 bits
• Long……….. 64 bits
• float ……….32 bits
• double……. 64 bits
• variabletype variablename = data;
Java Data and Variables
• For each primitive type, there is a corresponding wrapper class.
A wrapper class can be used to convert a primitive data value
into an object, and some type of objects into primitive data. The
table shows primitive types and their wrapper class
• primitive type Wrapper type
• byte Byte
• short Short
• int Int
• long Long
• Float Float
• double Double
• char Character
• Boolean Boolean
Java Arithmetic Operators
• The Java programming language has includes five
simple arithmetic operators like are + (addition),
- (subtraction), * (multiplication), / (division),
and % (modulo).
• Use Returns true if
• op1 + op2 op1 added to op2
• op1 - op2 op2 subtracted from op1
• op1 * op2 op1 multiplied with op2
• op1 / op2 op1 divided by op2
• op1 % op2 Computes the remainder of
dividing op1 by op2
Java Data and Variables
• x && y Conditional
AND If both x and y are true, result is true.
If either x or y are false, the result is false
If x is false, y is not evaluated.
Access Modifiers
• The first (left-most) modifier used lets you
control what other classes have access to a
member field. For the moment, consider only
public and private.
• public modifier—the field is accessible from
all classes.
• private modifier—the field is accessible only
within its own class.
• In the spirit of encapsulation, it is common to
make fields private. This means that they can
only be directly accessed from the Bicycle
class. We still need access to these values,
however.

More Related Content

What's hot

Java Data Types and Variables
Java Data Types and VariablesJava Data Types and Variables
Java Data Types and Variablessasi saseenthiran
 
Type checking compiler construction Chapter #6
Type checking compiler construction Chapter #6Type checking compiler construction Chapter #6
Type checking compiler construction Chapter #6Daniyal Mughal
 
OCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference CardOCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference CardHari kiran G
 
Primitive data types in java
Primitive data types in javaPrimitive data types in java
Primitive data types in javaUmamaheshwariv1
 
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building BlocksOCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building Blocksİbrahim Kürce
 
Android webinar class_java_review
Android webinar class_java_reviewAndroid webinar class_java_review
Android webinar class_java_reviewEdureka!
 
Compiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type CheckingCompiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type CheckingEelco Visser
 
Introduction to objects and inputoutput
Introduction to objects and inputoutput Introduction to objects and inputoutput
Introduction to objects and inputoutput Ahmad Idrees
 
Java platform
Java platformJava platform
Java platformVisithan
 
Fundamental programming structures in java
Fundamental programming structures in javaFundamental programming structures in java
Fundamental programming structures in javaShashwat Shriparv
 

What's hot (20)

M C6java3
M C6java3M C6java3
M C6java3
 
Java Data Types and Variables
Java Data Types and VariablesJava Data Types and Variables
Java Data Types and Variables
 
#_ varible function
#_ varible function #_ varible function
#_ varible function
 
Python Data Types
Python Data TypesPython Data Types
Python Data Types
 
M C6java2
M C6java2M C6java2
M C6java2
 
Type checking compiler construction Chapter #6
Type checking compiler construction Chapter #6Type checking compiler construction Chapter #6
Type checking compiler construction Chapter #6
 
OCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference CardOCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference Card
 
Primitive data types in java
Primitive data types in javaPrimitive data types in java
Primitive data types in java
 
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building BlocksOCA Java SE 8 Exam Chapter 1 Java Building Blocks
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
 
Java tokens
Java tokensJava tokens
Java tokens
 
Variable
VariableVariable
Variable
 
Android webinar class_java_review
Android webinar class_java_reviewAndroid webinar class_java_review
Android webinar class_java_review
 
Quick Scala
Quick ScalaQuick Scala
Quick Scala
 
Compiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type CheckingCompiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type Checking
 
Introduction to objects and inputoutput
Introduction to objects and inputoutput Introduction to objects and inputoutput
Introduction to objects and inputoutput
 
Inheritance
InheritanceInheritance
Inheritance
 
Ch6
Ch6Ch6
Ch6
 
Java platform
Java platformJava platform
Java platform
 
Lecture02 java
Lecture02 javaLecture02 java
Lecture02 java
 
Fundamental programming structures in java
Fundamental programming structures in javaFundamental programming structures in java
Fundamental programming structures in java
 

Similar to ITFT - Java

Similar to ITFT - Java (20)

Md03 - part3
Md03 - part3Md03 - part3
Md03 - part3
 
Learning core java
Learning core javaLearning core java
Learning core java
 
basics dart.pdf
basics dart.pdfbasics dart.pdf
basics dart.pdf
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Chapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingChapter 2: Elementary Programming
Chapter 2: Elementary Programming
 
OOP-java-variables.pptx
OOP-java-variables.pptxOOP-java-variables.pptx
OOP-java-variables.pptx
 
Preparing Java 7 Certifications
Preparing Java 7 CertificationsPreparing Java 7 Certifications
Preparing Java 7 Certifications
 
Java
JavaJava
Java
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Python Tutorial Part 1
Python Tutorial Part 1Python Tutorial Part 1
Python Tutorial Part 1
 
kotlin-nutshell.pptx
kotlin-nutshell.pptxkotlin-nutshell.pptx
kotlin-nutshell.pptx
 
demo1 java of demo 1 java with demo 1 java.ppt
demo1 java of demo 1 java with demo 1 java.pptdemo1 java of demo 1 java with demo 1 java.ppt
demo1 java of demo 1 java with demo 1 java.ppt
 
Introduction to c first week slides
Introduction to c first week slidesIntroduction to c first week slides
Introduction to c first week slides
 
Java
JavaJava
Java
 
Chapter 2 java
Chapter 2 javaChapter 2 java
Chapter 2 java
 
Enumerations in java.pptx
Enumerations in java.pptxEnumerations in java.pptx
Enumerations in java.pptx
 
Java Basics
Java BasicsJava Basics
Java Basics
 
cs213Lecture_1 java programming oopsss.pptx
cs213Lecture_1 java programming oopsss.pptxcs213Lecture_1 java programming oopsss.pptx
cs213Lecture_1 java programming oopsss.pptx
 
intro_java (1).pptx
intro_java (1).pptxintro_java (1).pptx
intro_java (1).pptx
 
Java Tokens
Java  TokensJava  Tokens
Java Tokens
 

More from Blossom Sood

ITFT - Web security
ITFT - Web securityITFT - Web security
ITFT - Web securityBlossom Sood
 
ITFT - Trends in it
ITFT - Trends in itITFT - Trends in it
ITFT - Trends in itBlossom Sood
 
ITFT - Search engine
ITFT - Search engineITFT - Search engine
ITFT - Search engineBlossom Sood
 
ITFT - Number system
ITFT - Number systemITFT - Number system
ITFT - Number systemBlossom Sood
 
ITFT - Java Coding
ITFT - Java CodingITFT - Java Coding
ITFT - Java CodingBlossom Sood
 
ITFT - DOS - Disk Operating System
ITFT - DOS - Disk Operating SystemITFT - DOS - Disk Operating System
ITFT - DOS - Disk Operating SystemBlossom Sood
 
ITFT - Window explorer
ITFT - Window explorerITFT - Window explorer
ITFT - Window explorerBlossom Sood
 

More from Blossom Sood (9)

ITFT- Dbms
ITFT- DbmsITFT- Dbms
ITFT- Dbms
 
ITFT - Web security
ITFT - Web securityITFT - Web security
ITFT - Web security
 
ITFT - Trends in it
ITFT - Trends in itITFT - Trends in it
ITFT - Trends in it
 
ITFT - Search engine
ITFT - Search engineITFT - Search engine
ITFT - Search engine
 
ITFT - Oops
ITFT - OopsITFT - Oops
ITFT - Oops
 
ITFT - Number system
ITFT - Number systemITFT - Number system
ITFT - Number system
 
ITFT - Java Coding
ITFT - Java CodingITFT - Java Coding
ITFT - Java Coding
 
ITFT - DOS - Disk Operating System
ITFT - DOS - Disk Operating SystemITFT - DOS - Disk Operating System
ITFT - DOS - Disk Operating System
 
ITFT - Window explorer
ITFT - Window explorerITFT - Window explorer
ITFT - Window explorer
 

Recently uploaded

Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxneillewis46
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi RajagopalEADTU
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxMohamed Rizk Khodair
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...Gary Wood
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................MirzaAbrarBaig5
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...Krashi Coaching
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSean M. Fox
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMELOISARIVERA8
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhleson0603
 
How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17Celine George
 
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatmentsaipooja36
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽中 央社
 

Recently uploaded (20)

Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptx
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17
 
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 

ITFT - Java

  • 2. Class • Class names should be nouns, in mixed case • with the first letter of each internal word capitalized. • Try to keep your class names simple • and descriptive. Use whole words—avoid • acronyms and abbreviations • Eg helloWorld,HelloWorld
  • 3. Methods • Methods should be verbs, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized. • run(); • runFast(); • getBackground();
  • 4. Variables • Except for variables, all instance, class, and • class constants are in mixed case with a lowercase • first letter. Internal words start with capital • letters. • Variable names should be short yet meaningful. • The choice of a variable name should be mnemonic— that is, designed to indicate to the use. • int I; • char
  • 5. Basic Program • class helloWorld • { • public static void main(String args[ ]) • { • System.out.println(“Hello World!”); • } • }
  • 6. Class Identification • The class definition • The first line is a declaration statement to introduce the code to the computer before it is used: • class notifies the interpreter that a new class will be defined. • helloWorld is the unique name for this new class. • The curly braces signal the beginning and end of the class body
  • 7. The main method • Atleast one and only one main method. • Java applets, however, do not contain main methods. • public is known as a 'global', a signal to the interpreter that this method can be used in other parts of the program. • The private keyword prevents the rest of the program from calling anything inside a method. • static tells the interpreter that the main method applies to everything in the helloWorld class, rather than just one element. Breathing and daily activities work as analogies for static and instance methods; daily activities vary but breathing is required. • void indicates that this method finishes operating without returning any results. • main is the unique identifier for this method and is a reserved word because all Java applications have one and only one main method. • The parentheses indicate that parameters can be passed to this method
  • 8. main(String args[ ]) • The String array • The third line declares an array, an element that stores a list of values like x[1,2,3]. Contrast arrays with variables that store only one value at a time, like x=3. String defines the type of values received: numbers, characters, and symbols. Args is the unique name for this array, and the brackets signal its array status.
  • 9. System class & output • System is a class in Java's default package and handles system hardware. • Out is an object of that class and handles output. • Println() is a method of System and accepts Hello, world! as a parameter to output to the screen. • Interpreters normally ignore spaces in stored values, so quotation marks declare this a string parameter to preserve such characters.
  • 10. Java Comments • The Java programming language supports three kinds of comments: 1. Double slashes in front of a single line comment: int i=5; // Set the integer to 5 2. Matching slash-asterisk (/*) and asterisk-slash (*/) to bracket multi-line comments: /* Set the integer to 5 */ int i=5; 3. Matching slash-double asterisk (/**) & asterisk-slash(*/) for Javadoc automatic hypertext documentation, as in /** This applet tests graphics.
  • 11. Java Data and Variables • byte • Short • int • long • float • Double • char • boolean
  • 12. Java Data and Variables • Integer types have no fractional part; floating point types have a fractional part. On paper, integers have no decimal point, and floating point types do. But in main memory, there are no decimal points: even floating point values are represented with bit patterns. There is a fundamental difference between the method used to represent integers and the method used to represent floating point numbers.
  • 13. Java Data and Variables • Type Size • byte ……….8 bits • Short……… 16 bits • int …………..32 bits • Long……….. 64 bits • float ……….32 bits • double……. 64 bits • variabletype variablename = data;
  • 14. Java Data and Variables • For each primitive type, there is a corresponding wrapper class. A wrapper class can be used to convert a primitive data value into an object, and some type of objects into primitive data. The table shows primitive types and their wrapper class • primitive type Wrapper type • byte Byte • short Short • int Int • long Long • Float Float • double Double • char Character • Boolean Boolean
  • 15. Java Arithmetic Operators • The Java programming language has includes five simple arithmetic operators like are + (addition), - (subtraction), * (multiplication), / (division), and % (modulo). • Use Returns true if • op1 + op2 op1 added to op2 • op1 - op2 op2 subtracted from op1 • op1 * op2 op1 multiplied with op2 • op1 / op2 op1 divided by op2 • op1 % op2 Computes the remainder of dividing op1 by op2
  • 16. Java Data and Variables • x && y Conditional AND If both x and y are true, result is true. If either x or y are false, the result is false If x is false, y is not evaluated.
  • 17. Access Modifiers • The first (left-most) modifier used lets you control what other classes have access to a member field. For the moment, consider only public and private. • public modifier—the field is accessible from all classes. • private modifier—the field is accessible only within its own class. • In the spirit of encapsulation, it is common to make fields private. This means that they can only be directly accessed from the Bicycle class. We still need access to these values, however.