0% found this document useful (0 votes)
5 views4 pages

Exam Java

The document provides an overview of Java programming concepts, focusing on methods, exception handling, and Java Server Pages (JSP). It differentiates between checked and unchecked exceptions, discusses the features of JSP and ASP, and outlines key exception handling keywords and mechanisms. Additionally, it covers the importance of exception handling and the concept of exception propagation in Java.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

Exam Java

The document provides an overview of Java programming concepts, focusing on methods, exception handling, and Java Server Pages (JSP). It differentiates between checked and unchecked exceptions, discusses the features of JSP and ASP, and outlines key exception handling keywords and mechanisms. Additionally, it covers the importance of exception handling and the concept of exception propagation in Java.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

1. A method:- in Java is a set of instructions that can be called for execution using the method name.

A method:- is a block of code which only runs when it is called.

Why Use Methods?

More manageable programming, ▪ Avoiding repeating code, ▪ Code reusability,

2.What are two non-abstract sub-classes of Throwable?

 Exception : can be handled


 Error : can’t be handled

3. EXCEPTION:- An exception is an event, which occurs during the execution of a program, that disrupts
the normal flow of the program's instructions.

EXECEPTION:- An exception is an abnormal condition that arises in a code sequence at run time.

4.DRAW BACKS:- Only people who are very familiar with JAVA can use JSP pretty well.

5. What is J2EE? J2EE, or Java 2 Platform, Enterprise Edition, is a set of specifications from Sun
Microsystems (now Oracle) for enterprise-level applications.

6. What is JSP technology AND WHEN IT DEVELOPED?

Java Server Pages (JSP) technology provides a simplified, fast way to create web pages that display
dynamicallygenerated content.

 developed through an industry-wide initiative led by Sun Microsystems in June, 1999,

7. What is Exception handling

is a mechanism that facilitates programmatic handling of run-time errors.

8. DIFFERINTIATE B/WN CHECKED UNCHECKED AND EXAMPLES?

A) Checked Exceptions are those, that have to be either caught or declared to be thrown in the method
in which they are raised.

EXAMPLE:-VIRTUAL MACHINE, I/OEXCEPTION, SQL EXECEPTIO.

A) Unchecked Exceptions are those that are not forced by the compiler either to be caught or to be
thrown.
B) EXAMPLES:- ArithmeticException - ArrayIndexOutOf BoundsException - NullPointerException
9.DISSCUSS JSP AND ASP?

JSP:-defines the interaction between the server and the JSP page, and describes the format and syntax
of the page.

JSP;- Any web server, including Apache, Netscape, IIS, Websphere, and Weblogic

ASP:- ASP technology is basically restricted to Microsoft Windows-based platforms.

ASP;- Microsoft Windows (Accessing other platforms requires third-party ASP porting products.

JSP VS ASP

JSP and ASP have some basic concepts in common.

1) They both make use of simple sever-side scripting to provide access to Web server information and
functionality.

2) They both have similar styles of delimiting this scripting from a page's content.

10.DIFFERENTIATE B\WN JSP AND ASP?

C) ASP?
ASP uses ActiveX controls for its components
ASP technology is basically restricted to Microsoft Windows-based platforms. Offered primarily
as a feature of Microsoft IIS,
ASP technology does not work easily on a broader range of Web servers
ASP pages use Microsoft VBScript or Jscript
D) JSP?
JSP technology adheres to the “Write Once, Run Anywhere” philosophy
•JSP technology can run on any Web server and is supported by a wide variety of tools from
multiple vendors.
 JSP technology uses the Java language for scripting

11. What is Servlets and its Key Features and common uses Cases?

 Java Servlets are server-side components that handle requests and responses in web
applications.

Request Handling, Platform Independence,

12. jsp or .jspx; this signals to the web server that the JSP engine will process elements on this page.

13. RuntimeException is the sub-class of Exception.


14. ArithmeticException

 ArrayIndexOutOfBoundsException, NumberFormatException, NullPointerException,IOException

15.What are Commonly used sub-classes of Errors?

 VirualMachineError, StackOverFlowError, NoClassDefFoundError, NoSuchMethodError

1. Scenarios where exceptions may occur?

 Scenario where NullPointerException occurs

16.Difference between throw and throws

• The Java throws keyword is used to declare an exception.

• The Java throw keyword is used to explicitly throw an exception.

17. What is A generalized exception handler ?

is one that can handle the exceptions of all types.

Note : If a class has a generalized as well as specific exception handler, then the generalized exception
handler must be the last one.

18.What is A custom exception class?

is represented by a subclass of Exception / Throwable.

19.What is The try statement?

contains a parenthesis in which one or more resources is declared.

20. Keywords for Exception Handling?

• try • catch • throw • throws • finally

21. Java finally:- block is always executed whether exception is handled or not.
22. .WHY EXECEPTION HANDLING?

When the default exception handler is provided by the Java run-time system ,.

23.JAVA EXCEPTION PROPAGATION;-An exception is first thrown from the top of the stack and if it is not
caught, it drops down the call stack to the previous method.
PREPARED BY OSAMA HASSAN ALI

You might also like