[OOP] Flashcards - Module 1
[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
includes external classes and libraries into the program.
Import Statements
subroutines contained in an object
instance methods
Scanner method that reads a word (string without spaces)
scanner_name.next();
a concept that allows classes to inherit code and properties from other classes.
Inheritance
Java is a programming language developed by ____ in the mid-____ known for its versatility, efficiency, and platform independence.
Sun Microsystems ; 1990s
the instructions executed by the program within methods.
Statements
occurs when the compiler automatically converts a value from one data type to another without explicit instructions from the programmer.
implicit typecasting
contains the Collections framework, formatted printing, and scanning.
java.util.*
Errors that lead to incorrect results
Logical Errors
is the package for input and output functionalities.
java.io.*
character sequences surrounded by double quotes.
strings
the package including classes for performing arithmetic operations.
java.math.*
Java operates on the “_____” principle,
write once, run anywhere
[syntax] declaring a new scanner in java
Scanner <scanner_name> = new Scanner(System.in);</scanner_name>
deals about creating objects that contain both data and functions.
Object-Oriented Programming
the rules that define how words and punctuation are organized in a programming language.
Syntax
These represent an abstract entity.
objects
[syntax] String lexicographic comparison
int <var_name> = str1.compareTo(str2); (result is 0 = equal, (-) = str1 < str2, and (+) = str1> str2</var_name>
describes the relationship between classes,
Association
the instances of a class created with specifically defined data.
Objects
special character combinations allowing you to represent the characters that are not printed using the normal way of printing.
Escape Sequences
refer to those functions that the objects can perform, defined inside the class.
Methods
[syntax] closing a scanner
scanner_name.close();
A single- line comment in Java starts with ____ and multiline comments are enclosed between ____
// ; /* */
The object behaviors are described in this
Methods
Carriage return and form feed escape sequence
\r and \f
contains networking capabilities.
java.net.*
OOP Principles
Encapsulation, Abstraction, Inheritance, Polymorphism, Syntax, Coupling, Association
[syntax] string copying
String str2 = str1.substring(0);
it is where the program execution begins
main() method
also known as format specifiers, are essential for displaying variable values in output statements in Java.
Placeholder
refers to the degree of dependency between software components.
Coupling
optional, and used for class organizations.
Package Declarations
Errors in Java
Compile-time Errors, Runtime Errors, Logical Errors
also known as type conversion is the process of converting a value from one data type to another, allowing you to modify the interpretation of a value.
Typecasting
Syntax Rules in Java
Case Sensitive, Class names start with uppercase, method names start with lowercase, file name = class name
Newline and Tab Escape sequence
\n and \t
the user-defined data types acting as the blueprint for individual objects, attributes, and methods.
Classes