Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Java Programming Basics: Identifiers, Types, Operations, Strings, Naming, If, Loops, Class, Slides of Java Programming

An overview of the fundamental concepts in java programming, including identifiers, primitive types, operations, java strings, java naming conventions, if statements, loops, classes, and keywords. It covers topics such as syntax rules for identifiers, different data types, order of precedence for operators, string manipulation, java naming conventions, conditional statements, and loop structures.

Typology: Slides

2012/2013

Uploaded on 04/23/2013

sarmistha
sarmistha 🇮🇳

3.8

(22)

113 documents

1 / 12

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Review
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Java Programming Basics: Identifiers, Types, Operations, Strings, Naming, If, Loops, Class and more Slides Java Programming in PDF only on Docsity!

Review

Executing code

Compile code (convert from Java to computer code)

  • Syntax errors will prevent compilation

Run code

  • Runtime errors will crash your program
  • Logic errors will make your program give the wrong output

Primitive Types

boolean - True or false char - (character) A letter or number int - (integer) Whole numbers long - (long integers) Larger whole numbers float - Decimal numbers double - Larger decimal numbers

doubles are approximations ints are exact but have a more limited rangeDocsity.com

Operations

Order of precedence (higher operations first): -, +, ++, -- and! (unary operators) *, / and % (binary operators)

  • and - (binary operators)

Assignment operators: ++, --, +=, -=, *=, /=, =

Java naming conventions

Conventions for identifiers:

Class - Start with uppercase (e.g. StringBuffer)

Object - Start with lowercase (noun) (e.g. homeworkOneGrade)

Method - Start with lowercase (verb) (e.g. isEmpty() ) Docsity.com

If statements

if (boolean expression) { // code } else { // more code }

|| is the OR operations && is the AND operations

Logical operations:

(greater than) == (equals) < (less than) = (greater than or equal to) != (not equal to) <= (less than or equal to)

Classes

Classes are a way of organizing and manipulating (methods) similar data (variables)

Methods can take in additional variables as arguments

If a value is returned, then this value will replace the method where it was called Docsity.com

Classes

Where a variable is visible/usable is called that variable's scope

Overloading is when two (or more) methods have the same identifier (name), but do different actions

Constructors are special methods that are always run when you make a class object

Classes are stored as a reference in memoryDocsity.com