0% found this document useful (0 votes)
11 views

OOPs Final Ans

The main features of object-oriented programming are classes, objects, inheritance, encapsulation, and abstraction. There are 8 types of operators in Java: unary, arithmetic, assignment, logical, shift, bitwise, ternary, and relational. An exception is an event that occurs during program execution and disrupts normal flow. Try and catch blocks are used to handle exceptions, with try specifying code that may throw exceptions and catch handling exceptions if thrown.

Uploaded by

Pravin Sakpal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

OOPs Final Ans

The main features of object-oriented programming are classes, objects, inheritance, encapsulation, and abstraction. There are 8 types of operators in Java: unary, arithmetic, assignment, logical, shift, bitwise, ternary, and relational. An exception is an event that occurs during program execution and disrupts normal flow. Try and catch blocks are used to handle exceptions, with try specifying code that may throw exceptions and catch handling exceptions if thrown.

Uploaded by

Pravin Sakpal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

What are the features of object-oriented programming?

The main features of object-oriented programming are Class, Object, Inheritance,


Encapsulation, and Abstraction Polymorphism. These features make the code
flexible , extensible, reusable and easy to understand.

What do you mean by exception?


Definition: An exception is an event, which occurs during the execution of a program,
that disrupts the normal flow of the program's instructions. When an error occurs
within a method, the method creates an object and hands it off to the runtime
system.

How many types of operator are there in Java?


Types of Java Operators:
• Unary Operators.
• Arithmetic Operators.
• Assignment Operators.
• Logical Operators.
• Shift Operators.
• Bitwise Operators.
• Ternary Operators.
• Relational Operators.

What is method overloading in Java with example?


• Method overloading in Java means having two or more methods (or functions)
in a class with the same name and different arguments (or parameters). It can
be with a different number of arguments or different data types of arguments.
For instance: void function1(double a)

What is try and catch and finally in Java?


The try block is used to specify a block of code that may throw an exception.
The catch block is used to handle the exception if it is thrown. The finally
block is used to execute the code after the try and catch blocks have been
executed.

What are the major features of Java programming?


• Object Oriented. In Java, everything is an Object. ...
• Platform Independent. ...
• Simple. ...
• Secure. ...
• Architecture-neutral. .Portable. ...Robust. ...
• Multithreaded.
How Java works step by step?
1. Creation of a Java program.
2. Compiling a Java program.
3. Loading the program into the memory by Java Virtual Machine.
4. Java Virtual Machine verification for bytecode, Java Program execution.

How do you invoke a constructor in Java?


What do you mean by constructor?
A constructor is a special method of a class or structure in object-oriented
programming that initializes a newly created object of that type. Whenever an object
is created, the constructor is called automatically
Constructors are invoked implicitly when you instantiate objects. The two rules for
creating a constructor are: The name of the constructor should be the same as
the class. A Java constructor must not have a return type.

What is this package in Java ? explain java API?


A package is a namespace that organizes a set of related classes and interfaces.
Conceptually you can think of packages as being similar to different folders on your
computer. You might keep HTML pages in one folder, images in another, and scripts or
applications in yet another.
Benefits of Packaging
• Packaging protects the product.
• Packaging keeps the product from going bad.
• Packaging decreases costs.
• Packaging informs. Packaging provides hygiene. Packaging means
economy. Packaging is a preventive measure.
The Java API is a library of prewritten classes, that are free to use, included in the Java
Development Environment. The library contains components for managing input,
database programming, and much much more. The complete list can be found at Oracles
website:

What is function overloading and overriding explain with an


example?
Method overloading is a type of static polymorphism. In Method overloading, we can
define multiple methods with the same name but with different parameters.
Method Overriding is a mechanism to achieve polymorphism where the super class
and the sub-class have same methods, including the parameters and signature
When two or more functions have the same name but their parameters are
different, it is called function overloading. On the other hand, function
overriding is one that provides a facility to redefine a function with a name
and signature same as the inheriting class.
What is the syntax of try and catch block?
Java try and catch

The try statement allows you to define a block of code to be tested for errors while it
is being executed. The catch statement allows you to define a block of code to be
executed, if an error occurs in the try block.

What is type casting explain with example in Java?


Type casting is a way of converting data from one data type to another data type.
This process of data conversion is also known as type conversion or type coercion.
In Java, we can cast both reference and primitive data types. By using casting, data
can not be changed but only the data type is changed.

What is JVM and its importance?


VVMs are small indicators that adhere to vaccine vials and change colour as the
vaccine is exposed to cumulative heat, letting health workers know whether the
vaccine has exceeded a pre-set limit beyond which the vaccine should not be used.

The main features of object oriented programming are as follows:


Classes, Objects, Abstraction, Polymorphism ,Inheritance, Encapsulation In the upcoming
sections, let’s see each object-oriented programming feature in detail.

The rules and conventions for naming your variables can be


summarized as follows:
1. Variable names are case-sensitive.
2. Subsequent characters may be letters, digits, dollar signs, or underscore characters.
3. If the name you choose consists of only one word, spell that word in all lowercase
letters.

What is polymorphism with example in Java?


Polymorphism means "many forms", and it occurs when we have many classes that are
related to each other by inheritance. Like we specified in the previous chapter; Inheritance
lets us inherit attributes and methods from another class. Polymorphism uses those
methods to perform different tasks.

What are the data types available in Java?


Primitive data types - includes byte , short , int , long , float , double , boolean and
char. Non-primitive data types - such as String , Arrays and Classes (you will learn
more about these in a later chapter)
Define:1) Stream
Java performs I/O through Streams. A Stream is linked to a physical layer by java I/O
system to make input and output operation in java.
Stream Reader class?
A class reader is a book that the learners read and analyse together in the class and
as homework over an extended period of time. It may be graded or have authentic
language.
Writer Stream Classes
The Writer class of the java.io package is an abstract superclass that represents a stream of
characters. Since Writer is an abstract class, it is not useful by itself. However, its subclasses
can be used to write data.

What is thread and types of thread in Java?


There are two types of threads in an application - user thread and daemon thread. When we
start an application, the main is the first user thread created. We can create multiple user
threads as well as daemon threads. When all the user threads are executed, JVM terminates
the program For example, in a browser, many tabs can be viewed as threads. MS Word uses
many threads - formatting text from one thread, processing input from another thread, etc.
S.NO Multiprocessing Multithreading
1. In Multiprocessing, While In Multithreading,
CPUs are added for many threads are
increasing computing created of a single
power. process for increasing
computing power.
2. In Multiprocessing, Many While in multithreading,
processes are executed many threads of a
simultaneously. process are executed
simultaneously.
3. Multiprocessing are While Multithreading is
classified into not classified in any
Symmetric and categories.
Asymmetric.
4. In Multiprocessing, While in Multithreading,
Process creation is a process creation is
time-consuming according to economical.
process.
5. In Multiprocessing, every While in Multithreading,
process owned a a common address
separate address space. space is shared by all
the threads.
Java Environment
• • Java Development Kit ( JDK ) The Java Development Kit ( JDK ) comes with
a collection of tools that are used for developing and running Java programs. They
includes: ...
• • Java Runtime Environment ( JRE ) The Java Runtime Environment ( JRE )
facilitates the execution of programs developed in java.

What is super and final keyword?


Super is a keyword of Java which refers to the immediate parent of a class and is used inside
the subclass method definition for calling a method defined in the superclass. A superclass
having methods as private cannot be called. Only the methods which are public and
protected can be called by the keyword super.

What do you mean by inheritance?


Inheritance is the process by which genetic information is passed on from parent to
child. This is why members of the same family tend to have similar characteristics.
What are different forms of inheritance?
They are as follows:
• Single Inheritance.
• Multiple Inheritance.
• Multilevel Inheritance.
• Hierarchical Inheritance.
• Hybrid Inheritance.

What is variable scope with example?


• Variables have a global or local "scope". For example, variables declared within
either the setup() or draw() functions may be only used in these functions. Global
variables, variables declared outside of setup() and draw(), may be used anywhere
within the program.

How can you use ternary operator in Java?


The syntax of the Java ternary operator is as follows: (condition) ? (return if true) :
(return if false); You often see the Java ternary operator symbols ( ? : ) used in texts and
tutorials as an abbreviation for the construct.

Life Cycle of a Thread


The life cycle of a thread can be defined as the state transitions of a
thread that starts from its birth till it ends. There are several life cycles in
which a thread lies at any instant.
• • New
• • Runnable
• • Blocked
• • Waiting
• • Timed Waiting
What is a label in Java?
A Label object is a component for placing text in a container. A label
displays a single line of read-only text.
What is short note on label in Java?
A Label object is a component for placing text in a container. A label displays a
single line of read-only text. The text can be changed by the application, but a user
cannot edit it directly.
What is Text Area in Java?
A Text Area object is a multi-line region that displays text. It can be set to allow
editing or to be read-only.

What are lists in Java?


Java List is an ordered collection. Java List is an interface that extends Collection
interface. Java List provides control over the position where you can insert an element.
You can access elements by their index and also search elements in the list.
What is Choice control in Java?
Choice control is used to show pop up menu of choices. Selected choice is shown on
the top of the menu.
What is a button in Java?
A button is basically a control component with a label that generates an event when
pushed.
The Checkbox class is used to create a checkbox. It is used to turn
an option on (true) or off (false). Clicking on a Checkbox changes
its state from "on" to "off" or from "off" to "on".

Primitive and non-primitive data types:


Primitive data types - includes byte , short , int , long , float , double
, boolean and char. Non-primitive data types - such as String ,
Arrays and Classes (you will learn more about these in a later
chapter)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy