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

Java

Java is a class-based, object-oriented programming language developed by James Gosling, known for its simplicity, security, and platform independence. It features a rich set of data types, operators, and control structures, and utilizes the Java Virtual Machine (JVM) for execution. Key concepts include abstraction, encapsulation, inheritance, and polymorphism, making Java a powerful tool for developing various applications.

Uploaded by

pd06032000
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)
7 views43 pages

Java

Java is a class-based, object-oriented programming language developed by James Gosling, known for its simplicity, security, and platform independence. It features a rich set of data types, operators, and control structures, and utilizes the Java Virtual Machine (JVM) for execution. Key concepts include abstraction, encapsulation, inheritance, and polymorphism, making Java a powerful tool for developing various applications.

Uploaded by

pd06032000
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

Introduction:
 Java is an class-based object oriented language(oop’s)
 It was developed by James gosling
 Java syntax are similar to c/c++
 It is simple and secure
 It is a high-level programming language
 It helps programmers and developers to write a code once and run it anywhere
 Java is an case sensitive
 Java is used to develop web application, windows applications, etc.…….

FEAUTURES OF JAVA:

 Simple
 Object-oriented
 Portable
 Platform independent
 Secured
 Robust (handle error)
 Interpreted (a computer program that helps convert a high-level program statement to a
machine code)
 High-performance
 Multithread
 Distributed
 Dynamic
 Architecture-neutral (platform-independent)
Syntax:
public class class_name
{
public static void main(String[] args)
{
System.out.println(“HELLO WORLD”);
}
}

JVM(java virtual machine)

Jvm is an abstract machine. It is called a virtual machine because it doesn’t physically exist. It is
specification that provides a runtime environment in which java bytecode can be executed

JRE(java runtime environment)

JRE (java runtime environment) is a acronym for java runtime environment, it is set of tools which
are used to provide runtime environment

JDK(java development kit)

JDK is a software development environment which is used to develop java application and applets

It contains JRE + JVM

COMMENTS:

Comments can be used to explain code, and to make it more readable. It can also be used to prevent
execution when testing alternative code
SINGLE-LINE COMMENTS:

 Single-line comments start with two forward slashes //


 Any text between // and the end of the line is ignored by java will not be executed

MULTI-LINE COMMENTS:

 Multi-line comments start with /* and ends with */


 Any text between /* and */ will be ignored by java

DATA TYPES:

A data type, in programming language, it is a classification that specifies which type of value

Is given

Data types can be divided into two groups

 Primitive data types (primitive data types are predefined)


 Non – primitive data types (non-primitive are created by the programmer)

PRIMITIVE DATA TYPES:

 Byte
 Short
 Int – (integer)
 Long
 Float
 Double
 Boolean
 Char – (character)

NON-PRIMITIVE DATA TYPES:

 String
 Array
 Classes

VARIABLES:

Variable is a container of data stored in a letter

Eg. Int a = 10;


Rules for declaring variables
 Variables cannot contains white spaces or blank spaces
 Variables cannot contains special characters
 Variables cannot be a keyword or reserve word
 Variables cannot starts with number
 Variable are case sensitive

JAVA RESERVERD WORDS:

Keyword Description

abstract A non-access modifier. Used for classes and methods: An abstract


class cannot be used to create objects (to access it, it must be
inherited from another class). An abstract method can only be used
in an abstract class, and it does not have a body. The body is
provided by the subclass (inherited from)

assert For debugging

boolean A data type that can only store true and false values

break Breaks out of a loop or a switch block

byte A data type that can store whole numbers from -128 and 127

case Marks a block of code in switch statements

catch Catches exceptions generated by try statements

char A data type that is used to store a single character


class Defines a class

continue Continues to the next iteration of a loop

const Defines a constant. Not in use - use final instead

default Specifies the default block of code in a switch statement

do Used together with while to create a do-while loop

double A data type that can store whole numbers from 1.7e−308 to
1.7e+308

else Used in conditional statements

enum Declares an enumerated (unchangeable) type

exports Exports a package with a module. New in Java 9

extends Extends a class (indicates that a class is inherited from another


class)

final A non-access modifier used for classes, attributes and methods,


which makes them non-changeable (impossible to inherit or
override)

finally Used with exceptions, a block of code that will be executed no


matter if there is an exception or not
float A data type that can store whole numbers from 3.4e−038 to
3.4e+038

for Create a for loop

goto Not in use, and has no function

if Makes a conditional statement

implements Implements an interface

import Used to import a package, class or interface

instanceof Checks whether an object is an instance of a specific class or an


interface

int A data type that can store whole numbers from -2147483648 to
2147483647

interface Used to declare a special type of class that only contains abstract
methods

long A data type that can store whole numbers from -


9223372036854775808 to 9223372036854775808

module Declares a module. New in Java 9

native Specifies that a method is not implemented in the same Java source
file (but in another language)
new Creates new objects

package Declares a package

private An access modifier used for attributes, methods and constructors,


making them only accessible within the declared class

protected An access modifier used for attributes, methods and constructors,


making them accessible in the same package and subclasses

public An access modifier used for classes, attributes, methods and


constructors, making them accessible by any other class

requires Specifies required libraries inside a module. New in Java 9

return Finished the execution of a method, and can be used to return a


value from a method

short A data type that can store whole numbers from -32768 to 32767

static A non-access modifier used for methods and attributes. Static


methods/attributes can be accessed without creating an object of a
class

strictfp Restrict the precision and rounding of floating point calculations

super Refers to superclass (parent) objects

switch Selects one of many code blocks to be executed


synchronized A non-access modifier, which specifies that methods can only be
accessed by one thread at a time

this Refers to the current object in a method or constructor

throw Creates a custom error

throws Indicates what exceptions may be thrown by a method

transient A non-accesss modifier, which specifies that an attribute is not part


of an object's persistent state

try Creates a try...catch statement

var Declares a variable. New in Java 10

void Specifies that a method should not have a return value

volatile Indicates that an attribute is not cached thread-locally, and is


always read from the "main memory"

while Creates a while loop

OPERATORS:

Operator is an symbol it is used to perform mathematical and logical operations


Operators can be classified into:

 Arithmetic operators

Arithmetic operators are used to perform common mathematical operations


+, -, *, /, %, ++, --

 Assignment operators

Assignment operators are used to assign values to variables


=, +=, -=, *=, /=, %=

 Comparison operators(conditional operator)

This operator is used to compare two values


<, >, <=, >=, ==, !=

 Logical operators

Logical operators are used to determine the logic between variables and values:
&&, ||, !

 Bitwise operators
To perform bit-level operations in C programming, bitwise operators are used.
&,|,^,~,<<,>>

& AND the value is 1 only if both bits are 1


| OR the value is one if any of the two bits is 1
^ XOR the value is one if the both bits are different
~ NOT inverts the all bits
<< left shift shift the bits to the left
>> right shift shift the bits to the right

JAVA SCANNER

The Scanner class is used to get user input, and it is found in


the java.util package.

To use the Scanner class, create an object of the class and use any of the
available methods found in the Scanner class documentation. In our example,
we will use the nextLine() method, which is used to read Strings:
METHODS DISCRIPTION
nextLine() To get string value
nextInt() To get integer value
nextFloat() To get decimal value
nextLong() To get long value
nextShort() To get short value

Eg:

JAVA IF ELSE STATEMENTS:

If statement:

If statement to specify a block of code to be executed if a condition is true

Syntax:

if(condition)
{
//block of codes
}
If..else statement:

Else statement to specify a block of code to be executed if the condition is false

Syntax:

if(condition)
{
//block of codes
}
else
{
//block of codes
}

Else if statement:
If the condition is true the block of statement will be executed else another else if statement will be
executed

Syntax:

if(condition)
{
//block of codes
}
else if(condition)
{
//block of codes
}
else
{
//block of codes
}

Ladder if statements:

The conditional expression are evaluated from the top downward. As soon as a true condition is
found otherwise the else statement will be executed

Syntax:

if(condition)
{
//block of codes
}
else if(condition)
{
//block of codes
}
else if(condition)
{
}
//block of codes
}
else
{
//block of codes
}
NESTED IF STATEMENTS:

Contains one if satetment inside of another if statement

If()

If()

If()

}
}

LOOPING STATEMENTS

 While loop

The certain block of code will be executed repeatedly until the condition is satisfied

while(condition)
{
//block of codes
Inc/dec;
}

 For loop

The certain block of code will be executed repeatedly until the condition is satisfied

for(condition; condition; inc/dec)


{
//block of codes
}
 Do…while loop

The separate block of code will be executed repeatedly until the while condition
is satisfied

The main difference between while and do..while is while loop checks the condition before
the running the program, do while first run the program and check that given condition

do
{
//block of code
}
while(condition);

JAVA STRING METHODS

Method Description Return


Type

charAt() Returns the character at the specified index char


(position)

codePointAt() Returns the Unicode of the character at the int


specified index

codePointBefore() Returns the Unicode of the character before int


the specified index

codePointCount() Returns the number of Unicode values found int


in a string.

compareTo() Compares two strings lexicographically int

compareToIgnoreCase() Compares two strings lexicographically, int


ignoring case differences

concat() Appends a string to the end of another String


string
contains() Checks whether a string contains a boolean
sequence of characters

contentEquals() Checks whether a string contains the exact boolean


same sequence of characters of the
specified CharSequence or StringBuffer

copyValueOf() Returns a String that represents the String


characters of the character array

endsWith() Checks whether a string ends with the boolean


specified character(s)

equals() Compares two strings. Returns true if the boolean


strings are equal, and false if not

equalsIgnoreCase() Compares two strings, ignoring case boolean


considerations

hashCode() Returns the hash code of a string int

indexOf() Returns the position of the first found int


occurrence of specified characters in a
string

isEmpty() Checks whether a string is empty or not boolean

lastIndexOf() Returns the position of the last found int


occurrence of specified characters in a
string

length() Returns the length of a specified string int

replace() Searches a string for a specified value, and String


returns a new string where the specified
values are replaced

startsWith() Checks whether a string starts with boolean


specified characters

toLowerCase() Converts a string to lower case letters String

toUpperCase() Converts a string to upper case letters String

trim() Removes whitespace from both ends of a String


string
ARRAY:
Array is a data structure it is used to store multiple values in a single variable, instead of declaring
separate variable for each value

Array is an limited data structure

ARRAY can be classified into:

 One dimentional array


 Two dimentional array
 Multi dimentional array

int[]a;

RECURSION:

Recursion is the technique of making a function call by itself or inside other function

Syntax:

Static void test()

test();

METHODS:

A method is a block of code which only runs when its called

You can pass data, known as parameters into a methods

class test
{
//FUNCTION CREATION
static void func_name()
{
//block of code
}
public static void main(String[] args)
{
func_name()//----------->CALLING THE FUNCTION
}
}

Parameters & Arguments:

Parameters the refers to the list variables in a method declaration

Arguments are the actual values the are passed in when the method involvement

class test
{
//FUNCTION CREATION
static void func_name(int a)//------>THIS IS A PARAMETER
{
//block of code
}
public static void main(String[] args)
{
func_name(10)//----------->THIS IS A ARGUMENT
}
}

METHOD OVERLOADING:

Multiple methods can have the same name with different parameters

Static int test(inta,intb)

returna+b;

}c

staticdoubletest(doublea,doubleb)

returna+b;

}
publicstaticvoidmain(String[]args){

// TODO Auto-generated method stub

intt1=test(13,4);

doublet2=test(9.0,5.6);

System.out.println(t1);

System.out.println(t2);

ABSTRACTION:

Data Abstraction is the process of hiding certain details and showing only essential information to
the user

To use abstraction we must use abstract keyword

You can access abstract objects using inheritance method

ABSTRACT CLASS

Abstract Class that cannot be used to create objects

To access it, it must be inherit from another class

abstract class bank

String pas,name;

Void menu()

Scanners=newScanner(System.in);

System.out.println("hello this method from abstract class");

Public lass test extends bank{


Public static void main(String[] args){

// TODO Auto-generated method stub

test t=new test();

t.menu();

ABSTRACT METHOD

It does not have a body the body is provided by the subclass


Abstract method can be created with abstract keyword

import java.util.*;

abstract class thamilmagan{

public abstract void address();

class rajesh extends thamilmagan

public void address()

System.out.println("address");

}
}

//main class

class vigneshwari

public static void main(String[] args)

rajesh s = new rajesh();

s.address();

INTERFACE:

interface bank

public void account();

}
Eg:

import java.util.*;

interface bank

public void account();

class person1 implements bank

public void account()

System.out.println("ACC");

class test

{
public static void main(String[] args)

person1 p1 = new person1();

p1.account();

JAVA OOPS CONCEPT:

Oop’s stands for object-oriented-programming-system

Procedural programming is about writing procedures or methods that performs operations on the
data

Object-oriented programming is about creating objects that contains both data and method

Advantages:

 Oops means object oriented programming language


 Oop is faster and easier to execute
 Oop provides a clear structure for the program
 Platform independent
 Oop help to keep the java code DRY(DON’T REPEAT YOURSELF) and makes the code easier to
maintain

CLASSES AND OBJECTS:

Class – it is a blueprint for objects

Object – it is an encapsulation of data along with functions that act upon that data

Class class_name

{
//create objects

void method_name()

//block of code

Class main_class

publicstaticvoidmain(String[]args)

class_name object_name = new class_name();

object_name.method_name();

Static members:

Static members have a global scope but with in a class, even without creating a object name

Non-static members:

Non-static members have local scope and it can accessed only through creating a object name for
class

INHERITANCE:
Inheritance is the concept of the one class acquire the properties of another class

In java to acquire the class we use extends keyword

Syntax:
Class classA
{
//objects
}
Class classB extends classA
{
//objects
}

Types of inheritance:

Single inheritance
Class classA
{
//objects
}
Class classB extends classA
{
//objects
}

The class extends with another class only one time

Multilevel inheritance
Class A
{
//block of code
}
Class B extends Class A
{
//block of code
}
Class C extends Class B
{
//block of code
}

A class extends another class, again extended class extends with another, like block chain class is
called multilevel inheritance
Hierarchical inheritance

Class A
{
//block of code
}
Class B extends Class A
{
//block of code
}
Class C extends Class A
{
//block of code
}

A class extends two class at the same time and that two class again extends the another two
repeatedly

Hybrid

Hybrid is a combination of multilevel and hierarchical inheritance

POLYMORPHISM:

Methods have same name but different message or action

CONSTRUCTOR:

Constructor is a special type of function it runs automatically when the object is created

Construct name same as class name it does not return any value

INTERFACE:

Interface is another way to achieve abstraction in java

We create interface using interface key word

We can access the interface using implements keywords

The body of the method can be provided by subclass

Interface interface_name{

Public void hide_func();


}

Class getinterface implements interface_name

//code

ENSCAPSULATION:

Enscapsulation hide sensitive data from the user

We use private keyword for enscapsulation

If you want make changes or display the enscapsulated data we use get or set method

import java.util.*;

class enscapsule

private String name;

public String getName()

return name;

public void setName()

this.name = "ajith";

}
}

//main class

class vigneshwari

public static void main(String[] args)

enscapsule e = new enscapsule();

e.setName();

System.out.println(e.getName());

ENUMERTION:

Enumeration is a group of constant values just like final

To create enumeration we use enum keyword

Enum months{

eg

import java.util.*;

enum signal{
/ RED,GREE,YELLOW

//main class

class vigneshwari

public static void main(String[] args)

signal stop = signal.RED;

System.out.println(stop);

JDBC-Java Database Connectivity

STEP1:

Download mysql connector on: https://dev.mysql.com/downloads/connector/j/

STEP2:

Select platform independent option on that website

STEP3:

After platform independent option was selected download the .tar or .zip file whatever you want

STEP4:

After downloaded that file you extract the jar file inside the .tar file or .zip file

STEP5:

Configure our mysql connector.jar file to our classpath

STEP6:

Execute our queries


STATEMENTS

Class.forName("com.mysql.cj.jdbc.Driver");

Connection con=null;

Con=DriverManager.getConnection("jdbc:mysql://localhost/
databasename","username","password");

System.out.println("CONNECTED");

con.close();

EXCEPTIONAL HANDLING:

Error handling is the process of handle the code errors made by the programmer like due to wrong
input or other unforesseable things

try:
try statement allows you to define a block of code to be tested for errors while it is being executed

catch:
catch statement allows you to define a block of code to be executed if an error occurs in the try
block

finally:
finally statement lets you execute code after try..catch regardless of the result

class test
{

public static void main(String[] args)


{
try
{
//block of code to be handle the error
}
catch(Exception e) //--->e is like variable the Exception will be
catch the error and store into the e
{
//error can be shown
}
finally{
//finally is an optional
}
//
}
}

The statement interface is used to create SQL basic statements in Java it


provides methods to execute queries with the database. There are different
types of statements that are used in JDBC as follows
 Create Statement
 Prepared Statement
 Callable Statement

Create a Statement:
From the connection interface, you can create the object for this
interface. It is generally used for general–purpose access to databases
and is useful while using static SQL statements at runtime.

Syntax:

Connection con=null;

con=
DriverManager.getConnection("jdbc:mysql://localhost/database_name","root","
");

Statement stmt= con.createStatement();

String sql="insert into details() values('ajith', 12, 1234567890)";

stmt.executeUpdate(sql);

stmt.close();

con.close();

try {
//ArrayList datas = new ArrayList();
HashMap datas = new HashMap();
int a = 0;
Connection con = null;
con =
DriverManager.getConnection("jdbc:mysql://localhost/s
pring","root","");
Statement stmt= con.createStatement();
String sql="select * from test";
ResultSet result =
stmt.executeQuery(sql);
while(result.next()) {
String val = "name"+a;

datas.put(val,result.getString("name"));
a++;
}
System.out.println(datas);
stmt.close();
con.close();
System.out.println("SUCCESS");

}
catch(Exception e) {
System.out.println(e);
}

2. Prepared Statement
represents a recompiled SQL statement, that can be executed many times.
This accepts parameterized SQL queries. In this, “?” is used instead of the
parameter, one can pass the parameter dynamically by using the methods of
PREPARED STATEMENT at run time.

Example

Scanners=newScanner(System.in);
Connectioncon=null;

con=DriverManager.getConnection("jdbc:mysql://
127.0.0.1/student","root","");

PreparedStatementstmt=con.prepareStatement("insert
into details(age, name) values(?,?)");

System.out.println("NAME:");

String name= s.nextLine();

intage=s.nextInt(); //mongod -version

stmt.setInt(1,age);

stmt.setString(2,name);

stmt.execute();

3. Callable Statement are stored procedures which are a group of


statements that we compile in the database for some task, they are
beneficial when we are dealing with multiple tables with complex scenario &
rather than sending multiple queries to the database, we can
send the required data to the stored procedure & lower the logic executed in
the database server itself. The Callable Statement interface provided by
JDBC API helps in executing stored procedures.
Syntax:

JAVA NETWORKING

SOCKET:

Java Socket programming is used for communication between the


applications running on different JRE.

Java Socket programming can be connection-oriented or connection-less.


Socket and Server Socket classes are used for connection-oriented socket
programming and Datagram Socket and Datagram Packet classes are
used for connection-less socket programming.

1. IP Address of Server, and


2. Port number.
S.NO METHODS DISCRIPTION
1 Class DataInputStream() It is used to receive a message
receive from the user
2 Class DataOutputStream() It is used send a message to
server
3 Void getInputStream() Encrypt the message
4 Void getOutputStream() Decrypt the message
5 socket It is used for client
6 serversocket It is used for server

SEVER:

CLIENT:

JAVA FILES

In Java, with the help of File Class, we can work with files.
This File Class is inside the java.io package.
The File class can be used by creating an object of the class and then
specifying the name of the file.

Why File Handling is Required?


 File Handling is an integral part of any programming language as
file handling enables us to store the output of any particular
program in a file and allows us to perform certain operations on it.
 In simple words, file handling means reading and writing data to a
file

METHODS:

Method Type Description

canRead() Boolean Tests whether the file is readable or not


canWrite() Boolean Tests whether the file is writable or not

createNewFile() Boolean Creates an empty file

delete() Boolean Deletes a file

exists() Boolean Tests whether the file exists

getName() String Returns the name of the file

getAbsolutePath() String Returns the absolute pathname of the file

length() Long Returns the size of the file in bytes

list() String[] Returns an array of the files in the directory

mkdir() Boolean Creates a directory

try
{
File f = new File("C:\\Users\\Ajith\\Desktop\\java\\
karthikeya.txt");

if(f.createNewFile())
{
System.out.println("created");
}
Else
{
System.out.println("NOT CREATED");
}
}
catch(Exception e)
{
System.out.println(e);
}

JAVA DATE AND TIME

Java does not have a built-in date class, but we can import the java.time.*

That package work with the date and time API, this package includes many date and time classes

Package: java.time.*;

LocalDate represents a date(year-month-day)

LocalTime Represents a time(hh-mm-ss-ns)

LocalDateTime represents both a date and time(y-m-d-h-m-s-ns)

DateTimeFormatter formatter for displaying and parsing date time objects

Localdate:

LocalDate a = LocalDate.now();

System.out.println(a);

JAVA THREAD

Thread allows a program to operate more efficiently by doing multiple things at the same time

Thread can be used to perform complicated task in the background without interrupting the main
program

FIRST METHOD:

Extending the Thread class and overriding its run()

class chrome extends Thread{

public void run(){


try{
//for(int i=0;i<10;i++){
System.out.println("chrome");
Thread.sleep(10000);
//}
}
catch(Exception e){
System.out.println(e);
}

}
}

class visualstudiocode extends Thread{


public void run(){
try{
String loading = "-";
for(int i=0;i<10;i++){
System.out.println("visualstudiocode");
System.out.println("Downloading"+(i*10)+loading.repeat(i*10));
Thread.sleep(1000);
}
}
catch(Exception e){
System.out.println(e);
}
}
}

class test{

public static void main(String[] args) {

chrome c = new chrome();


visualstudiocode vs = new visualstudiocode();
c.start();
vs.start();
}
}

SECOND METHOD:

Implements the runnable in class

S.N Modifier and Type Method Description


.

1) void start() It is used to


start the
execution of
the thread.

2) void run() It is used to


do an action
for a thread.

3) static void sleep() It sleeps a


thread for
the specified
amount of
time.

4) static Thread currentThread() It returns a


reference to
the currently
executing
thread
object.

5) void join() It waits for a


thread to die.

6) int getPriority() It returns the


priority of the
thread.

7) void setPriority() It changes


the priority of
the thread.

8) String getName() It returns the


name of the
thread.

9) void setName() It changes


the name of
the thread.

10) long getId() It returns the


id of the
thread.

11) boolean isAlive() It tests if the


thread is
alive.

12) static void yield() It causes the


currently
executing
thread object
to pause and
allow other
threads to
execute
temporarily.

13) void suspend() It is used to


suspend the
thread.

14) void resume() It is used to


resume the
suspended
thread.

15) void stop() It is used to


stop the
thread.

16) void destroy() It is used to


destroy the
thread group
and all of its
subgroups.

17) boolean isDaemon() It tests if the


thread is a
daemon
thread.

18) void setDaemon() It marks the


thread as
daemon or
user thread.

19) void interrupt() It interrupts


the thread.

20) boolean isinterrupted() It tests


whether the
thread has
been
interrupted.

21) static boolean interrupted() It tests


whether the
current
thread has
been
interrupted.

22) static int activeCount() It returns the


number of
active
threads in
the current
thread's
thread
group.

23) void checkAccess() It determines


if the
currently
running
thread has
permission to
modify the
thread.

24) static boolean holdLock() It returns


true if and
only if the
current
thread holds
the monitor
lock on the
specified
object.
25) static void dumpStack() It is used to
print a stack
trace of the
current
thread to the
standard
error stream.

26) StackTraceElement[] getStackTrace() It returns an


array of
stack trace
elements
representing
the stack
dump of the
thread.

27) static int enumerate() It is used to


copy every
active
thread's
thread group
and its
subgroup
into the
specified
array.

28) Thread.State getState() It is used to


return the
state of the
thread.

29) ThreadGroup getThreadGroup() It is used to


return the
thread group
to which this
thread
belongs

30) String toString() It is used to


return a
string
representatio
n of this
thread,
including the
thread's
name,
priority, and
thread
group.

31) void notify() It is used to


give the
notification
for only one
thread which
is waiting for
a particular
object.

32) void notifyAll() It is used to


give the
notification
to all waiting
threads of a
particular
object.

33) void setContextClassLoader() It sets the


context
ClassLoader
for the
Thread.

34) ClassLoader getContextClassLoader() It returns the


context
ClassLoader
for the
thread.

35) static getDefaultUncaughtExceptionHan It returns the


Thread.UncaughtExceptionHa dler() default
ndler handler
invoked
when a
thread
abruptly
terminates
due to an
uncaught
exception.
36) static void setDefaultUncaughtExceptionHan It sets the
dler() default
handler
invoked
when a
thread
abruptly
terminates
due to an
uncaught
exception.

JAVA SWING
Java Swing is a part of Java Foundation Classes (JFC) that is used to
create window-based applications. It is built on the top of AWT (Abstract
Windowing Toolkit) API and entirely written in java.

Unlike AWT, Java Swing provides platform-independent and lightweight


components.

The javax.swing package provides classes for java swing API such as
JButton, JTextField, JTextArea, JRadioButton, JCheckbox, JMenu,
JColorChooser etc.

JFC

The Java Foundation Classes (JFC) are a set of GUI components which simplify
the development of desktop applications.

JAVA COLLECTIONS:

The collection in java is a framework that provides an architecture to store and manipulate the
group of values

Java collections can achieve all the operations that you perform on a data such as searching, sorting,
insertion, deletion

 ArrayList
 Linkedlist
 Hashmap
 Hashset
 Iterator
 Vector
ARRAYLIST:
The arraylist class is a resizable which can be found in the java.util package

The difference between a built-in-array and an arraylist in java is that size of an array cannot be
modified

We can change, delete whatever you want in array list

JAVA ERROR HANDLING:

Error handling or exception handling it is a mechanism to handle runtime errors such as


classNotFoundexception, etc...

THROW:

The throw statement allows you to create custom error

FileNotFoundException

ArrayIndexOutOfBoundsException

SecurityException

You might also like