0% found this document useful (0 votes)
15 views2 pages

JAVA

KEY NOTES
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)
15 views2 pages

JAVA

KEY NOTES
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/ 2

PROGRAM-1

The import java.util.Scanner; statement in Java allows you to use the Scanner class, which
provides methods for reading user input from the console or other input sources.

PROGRAM-2

An interface Animaleat would define a set of methods related to an animal's eating behaviour
that any implementing class must provide.

PROGRAM-3

PayoutofBounds - In Java, ArrayIndexOutOfBoundsException (often referred to as "out of


bounds") is an exception that occurs when you attempt to access an index of an array that is
outside its valid range.

Super (); In Java, super (); is used to call the constructor of the parent (superclass) from a
subclass.

check Pay - which could refer to a method or function name typically used to verify or
calculate payment amounts in programming contexts.

The line int paylimit = in.nextInt(); in Java is used to read an integer value from user input via
a Scanner object named in. Here’s a breakdown of its components:

• int paylimit: Declares a variable named paylimit of type int (integer).

• in.nextInt(): Calls the nextInt() method on the Scanner object in, which reads the next
integer input from the user.

pob is likely a variable (or an object) that contains information about an exception or error
that occurred in the program.

PROGRAM-4

Threads allow multiple tasks to run concurrently within a single program.

Setting Priority: Thread priorities can be set using:

• Thread.MIN_PRIORITY: 1 (minimum priority)

• Thread.NORM_PRIORITY: 5 (normal priority)

• Thread.MAX_PRIORITY: 10 (maximum priority)

PROGRAM-5

import java.awt.*; -- In Java imports all classes from the Abstract Window Toolkit (AWT),
which provides a set of APIs for creating graphical user interfaces (GUIs) and handling events
in Java applications.
import javax.swing.JFrame; in Java imports the JFrame class from the Swing library, allowing
you to create a top-level window for your graphical user interface (GUI) applications.

PROGRAM-6

ListSelectionListener interface, which is typically used to respond to selection changes in a list


or table component within a GUI.

PROGRAM-7

import java.awt.*;: Imports all classes from the Abstract Window Toolkit (AWT), which
provides the core set of GUI components for building Java applications.

import java.awt.event.ActionEvent;: Imports the ActionEvent class, which represents a


specific action event (like button clicks) in the AWT event handling model.

import java.awt.event.ActionListener;: Imports the ActionListener interface, which allows


objects to listen for and respond to action events, such as when a button is clicked.

import javax.swing.*;: Imports all classes from the Swing library, which is a set of classes for
creating rich, platform-independent graphical user interfaces (GUIs) in Java applications.

tout: A variable representing a text component that is being used to display or update text in
a graphical user interface (GUI).

SwingUtilities.invokeLater(...) method is called with a lambda expression that creates and


displays a JFrame. executed on the Event Dispatch Thread (EDT)

PROGRAM-8

addActionListener method in Java is used to register an ActionListener to a component (like


a button) so that it can respond to user action events, such as clicks.

PROGRAM-9

import java.awt.*; -- Imports all classes from the Abstract Window Toolkit (AWT), which
provides the foundational components for building graphical user interfaces (GUIs) in Java.

import java.awt.event.MouseAdapter; -- Imports the MouseAdapter class, which is a


convenience class for receiving mouse events (like clicks and movements) without requiring
all methods of the MouseListener interface to be implemented.

import java.awt.event.MouseEvent; -- Imports the MouseEvent class, which represents


mouse events (such as mouse clicks, presses, and releases) that occur on components.

import javax.swing.*; -- Imports all classes from the Swing library, which is used for creating
rich, platform-independent graphical user interfaces (GUIs) in Java applications.

You might also like