basic elements of java language
DESCRIPTION
Basic Elements Of Java Language. Variables. Storage name of particular data type having specific value. They declares under specific daa type it may be Integer(example 0,1,2 or- 47 etc ) Boolean(example may be true or false) Double (10.2, 1.1 or -2.1 etc) - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Basic Elements Of Java Language](https://reader036.vdocuments.mx/reader036/viewer/2022062321/56812a71550346895d8df505/html5/thumbnails/1.jpg)
Basic Elements Of Java Language
for more lectures and notes visit www.basicsofprogramming.wordpress.com
![Page 2: Basic Elements Of Java Language](https://reader036.vdocuments.mx/reader036/viewer/2022062321/56812a71550346895d8df505/html5/thumbnails/2.jpg)
Variables
Storage name of particular data type having specific value. They declares under specific daa type it may be
Integer (example 0,1,2 or- 47 etc ) Boolean (example may be true or false) Double (10.2, 1.1 or -2.1 etc) String (shows text format e.g “JAVA", Pakistan etc they are strings)
for more lectures and notes visit www.basicsofprogramming.wordpress.com
![Page 3: Basic Elements Of Java Language](https://reader036.vdocuments.mx/reader036/viewer/2022062321/56812a71550346895d8df505/html5/thumbnails/3.jpg)
Operators
Those symbols perform simple calculation. Addition + Subtraction - Multiplication * Division / && (and) e.g (1 < x) && (x < 100) || (or) e.g (lightsOn) || (isDayTime) ! (not) e.g !(isStopped)
for more lectures and notes visit www.basicsofprogramming.wordpress.com
![Page 4: Basic Elements Of Java Language](https://reader036.vdocuments.mx/reader036/viewer/2022062321/56812a71550346895d8df505/html5/thumbnails/4.jpg)
Shortcut Assignment operators
for more lectures and notes visit www.basicsofprogramming.wordpress.com
Operator Example Equivalent
+= i+=8 i = i+8
-= f-=8.0 f = f-8.0
*= i*=8 i = i*8
/= i/=8 i = i/8
%= i%=8 i = i%8
![Page 5: Basic Elements Of Java Language](https://reader036.vdocuments.mx/reader036/viewer/2022062321/56812a71550346895d8df505/html5/thumbnails/5.jpg)
Arithmetic Expressions
for more lectures and notes visit www.basicsofprogramming.wordpress.com
3+4x _ 10(y-5) (a+b+c) + 9 4 9+x 5 x x y
In code It well be translated like:
(3+4*x)/5 – 10*(y-5)*(a+b+c)/x + 9*(4/x + (9+x)/y)
![Page 6: Basic Elements Of Java Language](https://reader036.vdocuments.mx/reader036/viewer/2022062321/56812a71550346895d8df505/html5/thumbnails/6.jpg)
Unicode Format
• Description Escape Sequence Unicode
• Backspace \b \u0008
• Tab \t \u0009
• Linefeed \n \u000a
• Carriage return \r \u000d
for more lectures and notes visit www.basicsofprogramming.wordpress.com
![Page 7: Basic Elements Of Java Language](https://reader036.vdocuments.mx/reader036/viewer/2022062321/56812a71550346895d8df505/html5/thumbnails/7.jpg)
for more lectures and notes visit www.basicsofprogramming.wordpress.com
Comparison Operators
• Operator Name
• < less than
• <= less than or equal to
• > greater than
• >= greater than or equal to
• == equal to
• != not equal to
![Page 8: Basic Elements Of Java Language](https://reader036.vdocuments.mx/reader036/viewer/2022062321/56812a71550346895d8df505/html5/thumbnails/8.jpg)
Commenting
Single Line We need forward slashes // for single line commenting. for example
// this is a single line comment
Multiple Line We use /* in first line and at the end line */ For example
/* this is multiple line comment Second line Third line And last one */
for more lectures and notes visit www.basicsofprogramming.wordpress.com
![Page 9: Basic Elements Of Java Language](https://reader036.vdocuments.mx/reader036/viewer/2022062321/56812a71550346895d8df505/html5/thumbnails/9.jpg)
Try First Program
Import acm.graphics.*;
Import acm.program.*;
Public class FirestProgram extends GraphicsProgram {
Public void run() {
Add{ new GLabel {“My First Program”,100,75}};
}
}
for more lectures and notes visit www.basicsofprogramming.wordpress.com
![Page 10: Basic Elements Of Java Language](https://reader036.vdocuments.mx/reader036/viewer/2022062321/56812a71550346895d8df505/html5/thumbnails/10.jpg)
END LECTURE # 3
Thanks
For next lecture (online, ppt or doc file)visit our website www.basicsofprogramming.wordpress.com
for more lectures and notes visit www.basicsofprogramming.wordpress.com