4 pillars Flashcards
(39 cards)
This is to make sure that “sensitive” data is hidden from users.
Encapsulation
Ways to do encapsulation
Declare a Class variables/attributes as private
Provide public get and set methods to access and update the value of a private.
Creating new classes based on existing ones.
Inheritance
the class that inherits from another class
subclass (child)
the class being inherited.
superclass(parent)
Allows us to perform a single action in different ways.
Polymorphism
is the process of hiding certain details and showing only essential information to the user.
Abstraction
is a restricted class that cannot be used to create objects (to access it, it must be inherited from another class).
abstract class
can only be used in an abstract class, and it does not have a body. The body is provided by the subclass (inherited from).
abstract method
illegal operation performed by the user which results in the abnormal working of the program
error
true or false:
Programming errors often remain undetected until the program is compiled or executed
true
true or false: Some of the errors inhibit the program from getting compiled or executed. Thus errors should be removed before compiling and executing.”
true
are detected during the execution of the program. Sometimes these are discovered when the user enters an invalid data or data which is not relevant
run time errors
True or false: Runtime errors occur when a program does not contain any syntax errors but asks the computer to do something that the computer is unable to reliably do.During compilation, the compiler has no technique to detect these kinds of errors.
true
detects it while the program is running.
Java virtual machine
true or false: To handle the error during the run time we can put our error code inside the try block and catch the error inside the catch block.
true
are those errors which prevent the code from running because of an incorrect syntax such as a missing semicolon at the end of a statement or a missing bracket, class not found, etc. These errors are detected by the java compiler and an error message is displayed on the screen while compiling
Compile Time Errors
Compile Time Errors are sometimes also referred to as
Syntax Error
True or False: Compile Time errors are easy to spot and rectify because the java compiler finds them for you. The compiler will tell you which piece of code in the program got in trouble and its best guess as to what you did wrong. Usually, the compiler indicates the exact line where the error is, or sometimes the line just before it, however, if the problem is with incorrectly nested braces, the actual error may be at the beginning of the block.
True
What does syntax error represent in the use of programming?
Grammatical errors
true or false: Misspelled variable name or method names is one of the examples of compile time errors
true
true or false : Missing semicolons is one of the examples of compile time errors.
true
true or false: Missing parenthesis, square brackets, or curly braces is not one of the example of compile time errors.
false, it is one of the example of compile time errors