Page 109 - Cs_withBlue_J_C11_Flipbook
P. 109
void calculate(int a, int b)
{
double q;
q = a/b;
System.out.println("quotient : "+q);
}
Note: If we take 0 in b, and as we know that we cannot divide anything by 0, so a runtime error will occur.
Let’s Revisit
♦ Java is a third-generation object-oriented programming language.
♦ Low-level languages are machine-oriented and require extensive knowledge of computer hardware and its configuration.
♦ Encapsulation is the wrapping up of data members and member methods together into a single unit.
♦ Data abstraction is the property by which the essential features of a class are represented without knowing the background
details that how it is actually executing, i.e., non-essential units are hidden from the user.
♦ Inheritance is the method which allows one class to inherit the properties (data members and member methods) of another class.
♦ Polymorphism is the feature of being able to allot a dissimilar meaning so that a variable, a method or an object can have more
than one form.
♦ Java stand-alone applications can run independently on an individual computer.
♦ Java applets are the small Java programs that are implanted in an HTML page and execute only within any web browser and
are mainly used for executing internet programming where graphics, sounds, and accepting user input are very important.
MIND DRILL
Solved Questions
A. Tick ( ) the correct option:
1. Java was officially released in ………………… .
a. 1991 b. 1995
c. 1997 d. 2020
2. Which of the following types of errors occur during the execution of a successfully compiled program?
a. Logical errors b. Runtime errors
c. Syntax errors d. None of these
3. Java is a programming language that uses ………………… .
a. procedure-oriented technology b. object-oriented technology
c. Both a and b d. None of these
4. Which of the following is/are the principles of object-oriented programming languages?
a. Encapsulation b. Data abstraction
c. Inheritance d. All of these
5. Which of the following buttons is used to compile a program in BlueJ?
a. Compile b. Close
c. Paste d. None of these
6. A grammatical error while coding leads to a ………………… .
a. Logical error b. Runtime error
c. Syntax error d. None of these
7. Which one of the following operating systems supports BlueJ?
a. Windows b. Mac OS X
c. Linux d. All of these
107
Introduction to Object-Oriented Programming Using Java 107

