You are on page 1of 3

1. Give a note on integer data types in Java.

2. Define a class? Give an example?


3. Define method?
4. State the uses of the keyword 'final'?
5. Explain the usage of try and catch clause
6. List any three common run time errors. Access specifiers are keywords that determine the type
of access to the
7. member of a class. These keywords are for allowing
8. privileges to parts of a program such as functions and variables. These are:
9. public: Any thing declared as public can be accessed from anywhere.
10. Private: Any thing declared as private can’t be seen outside of its class.
11. Protected: Any thing declared as protected can be accessed by classes in the same package
12. and subclasses in the other packages.
13. Default modifier: Can be accessed only to classes in the same package.
14. State the several states of 'Thread' in Java.
15. List out the advantages of multithreading.
16. What is the use of URL class in Java? Name any two methods in it.
17. Distinguish between component and container
1. Write the different types of access modifiers (Access specifiers)?
2. "Java is called Machine Independent language" - Justify this statement
with proper explanation.
3. difference between superclass and subclass?.
4. State the uses of the keyword 'final'?
5. List the different ways to handle exceptions?
6. List any three common run time errors.
7. State the several states of 'Thread' in Java.
8. List out the advantages of multithreading.
9. Define the use of URL class in Java? Name any two methods in it.
10. Define applets? What are the models available for event handling?

1) Access specifiers are keywords that determine the type of access to the member of a class.
These keywords are for allowing privileges to parts of a program such as functions and variables.
These are:

public: Any thing declared as public can be accessed from anywhere.


Private: Any thing declared as private can’t be seen outside of its class.
Protected: Any thing declared as protected can be accessed by classes in the same package
and subclasses in the other packages.
Default modifier: Can be accessed only to classes in the same package.
3) A super class is a class that is inherited whereas sub class is a class that does the
inheriting.

4)the uses of the keyword 'final'

 The class can be declared as final, if instances or subclasses are not to be created.
 The variables are declared as final, value of the variable must be provided at the time of
declaration.
 The Method can be declared as final indicating that they cannot be overridden by subclasses.

5)There are two ways to handle exceptions:

Wrapping the desired code in a try block followed by a catch block to catch the exceptions.

List the desired exceptions in the throws clause of the method and let the caller of the method
handle those exceptions.

6) A runtime error means that the program was compiled successfully, but it exited
with a runtime error or crashed. You will receive an additional error message, which is
most commonly one of the following:

1) Most common is "segmentation fault". This may be caused e.g. by an out-of-scope


array index causing a buffer overflow, an incorrectly initialized pointer, etc. This signal
is generated when a program tries to read or write outside the memory that is allocated
for it, or to write memory that can only be read. For example, you’re accessing a[-1] in a
language which does not support negative indices for an array.

2) "output limit exceeded". Your program has printed too much data to output.

3) "floating point error". This usually occurs when you’re trying to divide a number
by 0, or trying to take the square root of a negative number.

4) (non-zero exit code) - this message means that the program exited returning a
value different from 0 to the shell. For languages such as C/C++, this probably means
you forgot to add "return 0" at the end of the program. It could happen if your program
threw an exception which was not caught. Trying to allocate too much memory in a
vector.

5)(Memory Limit Exceeded)-This error means that your program tried to allocate
memory beyond the memory limit indicated. This can occur if you declare a very large
array, or if a data structure in your program becomes too large.

7) There are four states associated with a thread namely - new, runnable, dead, blocked
8) The advantages are as follows

 Can be created faster


 Requires less overheads
 Inter-process communication is faster
 Context switching is faster
 Maximum use of CPU time

9) URL stands for uniform Resource Locator and it points to resource files on the Internet. The URL has
four components - the protocol, IP address or the hostname, port number and actual file path Methods

getPort( ) à get the port number

getHost( ) à get the host name specified in URL

getFile( ) à get the file name

10) An applet is a dynamic and interactive program that runs inside a web page displayed by a Java
capable browser. This can also be executed using the appletviewer.

Event object that describes a state of change in a source. In other words, event occurs when an
action is generated, like pressing button, clicking mouse, selecting a list, etc. There are two types of
models for handling events and they are: a) event-inheritance model and b) event-delegation model

You might also like