Java 2 Marks
Java 2 Marks
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:
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.
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:
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
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
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