0% found this document useful (0 votes)
7 views9 pages

Topic Java

The document provides an overview of Java programming concepts, including class structure, methods, abstraction, encapsulation, polymorphism, exception handling, and input/output operations. It covers key topics such as constructors, collections, annotations, multithreading, and thread synchronization. Additionally, it explains the significance of access specifiers and the Java exception hierarchy.

Uploaded by

assignment99735
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views9 pages

Topic Java

The document provides an overview of Java programming concepts, including class structure, methods, abstraction, encapsulation, polymorphism, exception handling, and input/output operations. It covers key topics such as constructors, collections, annotations, multithreading, and thread synchronization. Additionally, it explains the significance of access specifiers and the Java exception hierarchy.

Uploaded by

assignment99735
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Wipro TilentNext 2025

---
public class HelloWorld
public: This keyword means the class is accessible from
anywhere.

class: Declares a class, which is a blueprint for objects or a


container for code.

HelloWorld: The name of the class. It must match the


filename (HelloWorld.java).

public static void main(String[] args)


This is the main method, the entry point of every Java
program.

public: This method is accessible from anywhere.

static: It can be run without creating an instance of the class.

void: It doesn't return any value.

main: The name of the method Java looks for to start


execution.

String[] args: An array to receive command-line arguments.

System.out.println("Hello, World!");
System: A built-in class in Java.
out: A static object of the PrintStream class connected to the
console.

println(): A method that prints the text and moves to the


next line.

"Hello, World!": The string that gets printed to the console.

Command-Line Arguments : Command-line arguments are


values passed to a Java program when you run it from the
command line

Abstraction : process of focusing on relevant detail and


leaving out the irrelevant detail
behaviour dikhna chahiye
attribute hide karna h

Abstract Class: Abstract methos ho sakta ha, Eska object nhi


ban sakta hai. Inherit kar sakta hai.

Encapsulation: wrapping up of attributes (data) and


behaviour in a single unit

Polymorphism: one name different form


-> Through method overloading
-> Through method overriding using
dynamic method dispatch

-> Access specifiers (public, private, default, protected)


-> Getter and Setter method
-> 'this' keywords
-> Method Overloading

-> 'static' member of class

-> Inheritance:
Advantage: Reusability

Provider is a super class (Super class is a parent class)


lene wala is a sub class/ child class (sub class is a child class)

-> Constructors
-> Constructors in Inheritance

Object Class: implicit of other class of super class

-> Method overloading: Jiske sath jayada matching ho uske


sath pahle perfect(prefare) karega

Interger: it is raper class in java

Exception: Run time error


-> Exception
-> Need for Exception handling
-> Java's default Exception handler and its
working..
-> Exception hander keyword
-> try
-> catch
-> finally
-> throw
-> throws

Exception class hierarchy


-> Exception
RunTimeException (Unchecked
Exception)
-> Error

Categories of Exception
-> Checked
-> Unchecked

User Define(Custom) Exception :

Protected access is not access in the class


Packages: similar class, and interface similar type of
interface
type of container related java element

package
Advantage
Namespace Resolution
Access Control
Package Creation
Package Usage

Input/Output (I/O)
I/O Steams
Byte Streams: Binary input taken
InputStream
FileInputStream
BufferedInputStream
OutputStream
FileInputStream

BufferedOutputStream
Character Streams: Character input
taken
Reader
FileReader
BufferedReader
InputStreamReader:
Convert character to bytes in input
Writer
FileWriter
BufferedWriter
OutputStreamWriter:
Convert character to bytes in output
Serialization(/Deserialization)

File Reading/ Writing


readNBytes: Read number of bytes. return type is bytes
array.

6 Method of file reading(InputStream methods which define)


i) .read()
ii) byte[] bytes = new byte[4]; // byte data type and bytes
variable name which is array type
fis.read(bytes);
iii) fis.read(bytes,1,2); // bytes means array name, 1 means
staring point, 2 means byte size such as |d|e|f|g| then
|d|h|i|g| change I and 2.
str = new String(bytes);
iv) str = new String(fis.readNBytes(4)); // print after 4 bytes,
v) fis.readNBytes(bytes,1,2); // same as methos iii. where,
readNBytes:- Read number of bytes
vi) str = new String(fis.readAllBytes()); // print all the unread
bytes/ character.

For available chack then use : .available() methos use eg.-


fis.available();
For skip then use: .skip(byte skip (5)) use this method eg.:
fis.skip(5);

Notes:
When end of file then read() return the -1 values.
When end of file then readNBytes() return the 0 values.
Collection <> (Angular Bracket)
-> Common interface
-> add() : single add
-> addAll() : add all
-> clear() : clear all
->

Collections Framework
ArrayList
HashList
LinkedList
Queue
Set : In set not return duplicate
Map: key pair value store, it are not extends, not
contain duplicate,

Annotations:
Annotation: Used to provide metadata or
supplementary information
Built - in Annotations
User defined or Custom Annotation
Meta Annotation
Marker Annotation
Single Member Annotation + value field
concept of 'default' in annotation fields
Type Annotation
Repeatable

In single value annotation me, value rakhte ha to,


value likhna nhi hoga.
If annotation field ke value nhi dena ha to, default
value assign ho jayega.

When use the TYPE_USE annotation ko attribute, object,


parameter, and throws Exception k jagah pe use kar sakte
hai..

Wrapper

Multithreading
-> Thread
'Thread' class
Data Members
Member Methods
Constructors
Thread()

Thread(String threadName)

Thread(Runnable ref)

Thread(Runnable ref, String threadName)


Thread Creation
- Inheriting Thread Class
- Implementing Runnable
Interface
Thread States
Thread Synchronization

syntax: Way to write the code.


semantic :variable ability to change, if final variable then not
changes. Kya matlab nikalta ha use semantic kahte ha.

Thread[#1// thread number which is unique,main//


thread,5// priority,main// parent thread]

Inter Thread Communication


** object class method

You might also like