Some Imp Questions
Some Imp Questions
The throws keyword is used to indicate that a method might throw one or
more exceptions during its execution.
Only checked exceptions (like IOException, SQLException) need to be
declared using throws.
Unchecked exceptions (like NullPointerException, ArithmeticException)
don't require throws.
Syntax:
import java.io.*;
Checked Exception
These are checked at compile time. If not handled, the code will not compile.
1. Lightweight components
2. Pluggable Look and Feel
3. Follows MVC architecture
4. Highly customizable
5. Event-driven programming
6. Pure Java implementation (platform-independent)
7. Integration with AWT
8. Supports drag and drop, tooltips, and accessibility
Wrapper Class
byte Byte
short Short
int Integer
Primitive Type Wrapper Class
long Long
float Float
double Double
char Character
boolean Boolean
Extending an interface
Extending an interface means creating a new interface that inherits the methods
of one or more existing interfaces.
This is similar to class inheritance, but interfaces can extend multiple interfaces,
supporting multiple inheritance of type.
Syntax:
java
CopyEdit
interface A
{
void methodA();
}
interface B extends A
{
void methodB();
}
Example:
interface Printable
{
void print();
}
interface Scannable
{
void scan();
}
Jaise hum class ko extend karte hai waise hi interface ko extend karte hai.,…bus
aakhri me function ki coding class me karni padegi hame….interface nahi kar sakte
coding function ki