Unit 1 2.marks
Unit 1 2.marks
5. Define a class.
A class is a collection of objects with similar attributes and operations. Eg. Class – Account
It will create an object savings_account belonging to the class Account
6.Define Inheritance?
Inheritance is the process by which objects of one class acquire the properties of objects ofanother class.
The new derived class inherits the members of the base class and also adds its own.
9. Define Abstraction.
It refers to the act of representing essential features without including the backgrounddetails.
10. Give the syntax of Array Initialization with an example.
Data-type array-name[size] = {list of values separated by comma};(eg.) int mark[5] =
{96,45,66,74,82};
Unit 2
Inheritance,packages and interfaces
1. What is meant by Inheritance and what are its advantages?
Inheritance is a relationship among classes, wherein one class shares the
structure or behavior defined in another class. This is called Single Inheritance. If
a class shares the structure or behavior from multiple classes, then it is called
Multiple Inheritance. Inheritance defines “is-a” hierarchy among classes in which
one subclass inherits from one or more generalized super classes. The advantages
of inheritance are reusability of code and accessibility of variables and
methods of the super class by subclasses.
3. What is an Interface?
Interface is an outside view of a class or object which emphasizes its abstraction
while hiding its structure and secrets of its behavior
6.
What is the difference between abstract class and interface?
ABSTRACT CLASS INTERFA
CE
1. Abstract class must have at All the methods declared
least one abstract method and inside an interface are
others may be abstract
concrete or abstract
2. In abstract class, key word Interface we need not use that
abstract keyword
must be used for the methods for the methods.
3. Abstract class must have Interface can’t have subclasses
subclasses
7. Define Package.
To create a package is quite easy: simply include a package command as the first
statement in a Java source file. Any classes declared within that file will belong to the
specified package. The package statement defines a name space in which classes are
stored. If you omit the package statement, the class names are put into the default
package, which has no name.
Unit 3
3.
Name any four java built in exceptions.
Excepti Meani
on ng
ArithmeticException Arithmetic error, such as divide-by-zero.
ArrayIndexOutOfBoundsExce Arithmetic Exception Array index is out-of-
ption bounds.
ArrayStoreException Assignment to an array element of an
incompatible type.
ClassCastException Invalid cast
Unit 4
I/O,Generies,String Handling
2Marks
1.Define stream.
A stream can be defined as a sequence of data. There are two kinds of Streams
InputStream − The InputStream is used to read data from a source.
OutputStream − The OutputStream is used for writing data to a
destination.
.Method Description
void write (byte buffer [] ) writes an array of bytes to the output stream
Void write(bytes buffer[],int writes 'nBytes' bytes to the output stream from the
loc, int nBytes) buffer b starting at buffer [loc]
equals() :In Java, string equals() method compares the two given strings
based on the data/content of the string. If all the contents of both the strings are same
then it returns true. If any character does not match, then it returns false.
Unit 5
JAVAFX Event Handling, Controls and Componenets
2marks
1 .What is JavaFX?
JavaFX is a set of graphics and media packages that enables developers to design, create,
test, debug, and deploy rich client applications that operate consistently across diverse
JavaFX provides several predefined layouts such as HBox, VBox, Border Pane, Stack Pane,
Text Flow, Anchor Pane, Title Pane, Grid Pane, Flow Panel, etc. Each of the above
mentioned layout is represented by a class and all these classes belongs to the package
javafx.
Accordion.
Button.
CheckBox.
ChoiceBox.
ColorPicker.
ComboBox.
DatePicker.
Label.
The textarea is an input element using for multiple line information in the web
application. It is providing multiple lines of input information from the user and store in the
application. It is interacted between user and application using a textarea object and set in the
database.
To create a text field, you need to instantiate the TextField class, to the constructor of this
class you can also pass a string value which will be the initial text of the text field.
Stage. A stage (a window) contains all the objects of a JavaFX application. ...
Scene graph.
Nodes.