SlideServe
Menu
Préférences
© SlideServe · v2026

Understanding Java Basics: Variables, Operators, and Expressions

thomas-alvarez avatar
10 diapositives · 245 Views · Nov 30, 2014

This lecture notes cover the foundational elements of the Java programming language. Learn about variables, which store data of specific types, such as integers, booleans, doubles, and strings. Discover operators for performing calculations, including arithmetic and comparison operators. Explore the concept of assignment shortcuts and arithmetic expressions. Additionally, understand Unicode formatting and the importance of comments for effective code documentation. For more resources and lectures, visit www.basicsofprogramming.wordpress.com.

Understanding Java Basics: Variables, Operators, and Expressions - slide 1
01 / 10Understanding Java Basics: Variables, Operators, and Expressions
1 / 17

Télécharger la présentation

Understanding Java Basics: Variables, Operators, and Expressions
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Basic Elements Of Java Language for more lectures and notes visit www.basicsofprogramming.wordpress.com

  2. 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

  3. 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

  4. Shortcut Assignment operators 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 for more lectures and notes visit www.basicsofprogramming.wordpress.com

  5. Arithmetic Expressions 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) for more lectures and notes visit www.basicsofprogramming.wordpress.com

  6. 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

  7. Comparison Operators • Operator Name • < less than • <= less than or equal to • > greater than • >= greater than or equal to • == equal to • != not equal to for more lectures and notes visit www.basicsofprogramming.wordpress.com

  8. 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

  9. 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

  10. 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