Import Java

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Import java.io.

Agr function public ha too file ka name bhi wohi hona chahiye

Import java.Scanner

Used for input

Int x=parseInt(ch)

Aggregation mn main class ky andr hi main bnaye gy

Inheritance agr multiple hoo too sari classes access ni hoti agr hierarchical ho too ho jati hnn

Inheritance mn test class bna ky hi main bnaye gy uss mn

Main ko hum overloadkr sakty hn but JVM srf jiss mn string[] args ho ga ussi ko hi use kr sakta ha

Agr child class mn bhi same name se function hoo too usko hum over riding kehty hnn

Inheritance mn hi overriding use hota ha

Super keyword is used in place of parent class name or object

Final restrict value changing restrict inheritance restrict overriding we can override with static keyword
no final constructor

Polymorphism mn bhi overriding hi use hoti ha

Binding is connecting a function call to function body function or object

There can be

Static binding when type of object is determined at compile time no separate class object is created in
same class in which main exists

Dynamic binding is when type of object is determined at runtime object of other class is created in main

Instance of checks whether an object is of some class or not also called type comparison operator

Syntax

Object instance of class_name

Abstraction is a process of hiding the implementation details and showing only functionality to the user

must be declared with an abstract keyword. It can have abstract and non-abstract methods. It can have
constructors and static methods also. It can have final methods which will force the subclass not to
change the body of the method
abstract class ka object nhi bnta magr abstract_class obj=new child_class();

obj.child_function();

this will call and execute child method

agr dono classes hi hn too extend krti hnn relationship mn but agr alag hun jesse interface aur class to
hum implements use krn gy

interface is a blue print used to implement abstraction

multiple inheritance is not applicable in inheritance but applicable in interface

abstract window toolkit is heavy weight API provide graphical user interface components to windows

4 container

Frame

Window no border or menu

Panel no title bar border menu

Dialogue

Code

Frame

Label

Text field

Text area

Button

Choice

List

Check box

Check box group

Menu bar

Popup menu

Panel
Dialogue no maximize and minimize buttons

5 Steps to connect to the database in java

1. Register the driver class

2. Create the connection object

3. Create the Statement object

4. Execute the query

5. Close the connection object

You might also like