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

Java

The document outlines various concepts and features of Java, including its characteristics, exception handling, type casting, and differences between AWT and Swing. It also covers static import, proxy servers, JDBC methods, and threading concepts. Additionally, it includes programming tasks related to user input, GUI components, and database connectivity.
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)
2 views4 pages

Java

The document outlines various concepts and features of Java, including its characteristics, exception handling, type casting, and differences between AWT and Swing. It also covers static import, proxy servers, JDBC methods, and threading concepts. Additionally, it includes programming tasks related to user input, GUI components, and database connectivity.
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

Java

2 mrks

a) List any four features of Java

 Platform independent

 Object-oriented

 Secure

 Robust

b) Define static import. Give its syntax

Definition: Static import allows access to static members without class


name.
Syntax:

import static [Link].*;

c) Define exceptions. List its types

Definition: Exception is a runtime error that disrupts program flow.


Types:

 Checked Exception

 Unchecked Exception

d) Define type casting. List its types

Definition: Converting one data type into another.


Types:

 Implicit (Widening)

 Explicit (Narrowing)

e) Any two differences between AWT and Swing

 AWT is platform dependent; Swing is platform independent

 AWT uses native components; Swing uses lightweight components


f) Define proxy server, reserved socket

 Proxy Server: Acts as an intermediary between client and internet

 Reserved Socket: Socket using well-known port numbers (0–1023)

g) Any four methods of Statement

 executeQuery()

 executeUpdate()

 execute()

 close()

Next Set

a) Two uses of super keyword

 Access parent class variables

 Call parent class constructor

b) Difference between Statement and PreparedStatement

 Statement is simple; PreparedStatement is precompiled

 PreparedStatement is faster and more secure

c) Define event and listener

 Event: Action like click or key press

 Listener: Object that handles the event

d) Two static methods of InetAddress (syntax + use)

 [Link](String host) → gets IP of host

 [Link]() → gets local system address

e) Difference between Vector and Array

 Vector is dynamic; Array is fixed size


 Vector is synchronized; Array is not

f) Define Synchronization (thread)

Synchronization controls access of multiple threads to shared resources to


avoid conflicts.

g) List any four features of Java

 Platform independent

 Secure

 Robust

 Multithreaded

4 Mrks

a) Write a program to accept age from user and throw an exception if age
is less than 18. b) Explain garbage collection in Java.

c) Write a program to use Label, TextField and Button to create login form.
When user clicks the button, login successful/ unsuccessful message
should be displayed.

d) Differentiate between TCP and UDP.

a) Define type casting. Explain its types with example.

b) Describe life cycle of thread with neat diagram.

c) Write a program to display the protocol, host, port and file of URL
(Accept URL from user).

d) Differentiate between AWT and swing (Any four points).

a) Explain constructor with its types. Give example.

b) Write a program to create two threads. Thread A should print even


numbers from 1 to 50 and thread B should print odd numbers from 1 to
50. Each thread should relinquish control to the other frequently.

c) Explain final with respect to inheritance. Describe how final method is


different from abstract method.

d) Write a program to list five states using JcomboBox. Display selected


item in JTextfield
a) Write a program to use JTextField, JLabel and JButton to add two
numbers and display the output. Use Gridlayout.

b) Define package. Explain how to create and access user defined


package in java.

c) Write a program to read and display content from the url


“[Link]

d) Explain the different types of JDBC drivers.

e) Write a program to use keylistener to display characters entered by


user

a) Explain garbage collection concept in Java.

b) Describe creating a thread by extending ‘Thread’ class with one


example.

c) Explain process to create and access user defined package in Java with
example.

d) Write a program to demonstrate the use of Grid layout.

a) Explain uses of ‘Final’ keyword with example. (Any two points)

b) Write a program to list the empno, ename and salary of five employees
using J Table. c) Write a program using URL and URL connection class to
retrieve the date content type, content of any entered URL.

d) Write a program to change the background colour of applet to red when


user clicks the ‘Change color’ button.

e) Explain JDBC three tier architecture.

You might also like