[OOP] Flashcards - Module 1
(62 cards)
[syntax] reading a character
scanner_name.next().charAt(0);
8 data types in java
char, boolean, byte, int, short, long, float, double
the only object that is defined, when a class is initially defined.
description
refer to an object’s state.
Attribute
include defining the class encapsulating data and methods.
Class Definitions
This is also known as automatic type promotion.
Implicit Typecasting
[syntax] typecasting char to int (for ASCII Value) and vice versa
int asciiValue = (int) ch ;
char ch = (char) asciiValue;
[syntax] String content comparison
boolean <var_name> = str1.equals(str2); (result is either true or false)</var_name>
Backslash and backspace escape sequence
\ and \b
the principle where objects can share behaviors and adopt multiple forms.
Polymorphism
Double/Single quote escape sequence
" and '
characteristics distinguishing classes.
Attributes
[syntax] string input using a scanner in java
String str = scanner_name.nextLine():
errors that occur during the execution of the program.
Runtime Error
In initializing characters, they should be enclosed in ____
single quotes
A form of typecasting that requires the programmer to specify the desired data type.
explicit typecasting
OOP Building Blocks
Classes, Objects, Methods, and Attributes
the syntax or semantic errors detected at compile time.
Compile-time Errors
Basic Structure of Java
Package Declarations, Import Statements, Class Definitions, main() method, Statements
The data stored by the objects are kept in this field.
attributes
Import Statements in Java
java.util., java.io., java.net., java.math.
used by programmers for reusability or keeping the functionality encapsulated inside one object at a time.
Methods
a principle where objects expose only the internal mechanisms necessary for other objects to function,
Abstraction
principle that dictates that an object contains all its essential information, with only selected details made accessible.
Encapsulation