OOP - Week 1 Flashcards
Why is Object Oriented Programming useful
It makes programming similar to thinking about the real world
What is the name of variables in an object
Fields
What is the name of functions in an object
Methods
How are objects created
Using classes
Advantages of OOP vs Procedural
More secure, readable and reusable, easier to maintain/debug
Disadvantages of OOP vs Procedural
Needs more lines of code
Slower programs
Steep learning curve
What do {} do for classes
They mark the body of the class
What must a java app have
A main method as an execution point of the program
What is the signature of the main() method
public static void main(String[] args)
Commenting in Java
Single line - //
Multi line - /* */
Variable steps
Declaration - Data type and name
Initialisation - Initial value
Assignment - Value replacement
What are the java float data types
Float (32-bit)
Double (64-bit)
What do x++ and x– mean
x+1 and x-1
What is the difference between b=a++ and b=++a
b=a++ adds 1 to a after making b equal to a
How to make a float not count as a double
Add f to the end of the number