0% found this document useful (0 votes)
0 views

Java Basic Definitions

The document provides an overview of basic concepts in Java, including graphics, animation, exceptions, threading, and GUI components. It explains key features such as method and constructor overloading, inheritance types, and the role of the Java Virtual Machine (JVM). Additionally, it covers various GUI elements and their functionalities, along with thread priorities in Java.

Uploaded by

kondaiappaswamy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Java Basic Definitions

The document provides an overview of basic concepts in Java, including graphics, animation, exceptions, threading, and GUI components. It explains key features such as method and constructor overloading, inheritance types, and the role of the Java Virtual Machine (JVM). Additionally, it covers various GUI elements and their functionalities, along with thread priorities in Java.

Uploaded by

kondaiappaswamy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

BASIC CONCEPTS IN JAVA

1. Graphics Class
The Graphics class in Java is a part of the Abstract Window Toolkit (AWT) and is used to draw
graphics, such as lines, shapes, and text, on the screen. It provides methods for drawing,
painting, and manipulating graphics.

2. Animation
Animation in Java refers to the process of creating the illusion of movement by displaying a
sequence of images or graphics in rapid succession. Java provides several APIs, such as the
Graphics class and the Java 2D API, to create animations.

3. Exception
An exception in Java is an event that occurs during the execution of a program, such as an error
or an unexpected condition, that disrupts the normal flow of instructions. Exceptions can be
caught and handled using try-catch blocks.

4. Built-in Exception
Built-in exceptions in Java are predefined exceptions that are part of the Java language, such
as ArithmeticException, NullPointerException, and IOException. These exceptions are thrown
by the Java runtime environment when a specific error or condition occurs.

5. User-Defined Exception
A user-defined exception in Java is a custom exception class that is created by a programmer to
handle specific error conditions or exceptions that are not covered by built-in exceptions.
User-defined exceptions can be thrown and caught just like built-in exceptions.

6. Thread
A thread in Java is a separate flow of execution that can run concurrently with other threads.
Threads are lightweight processes that share the same memory space and resources, allowing
for efficient and concurrent execution of tasks.

7. Multithread
Multithreading in Java refers to the ability of a program to execute multiple threads concurrently,
improving responsiveness, efficiency, and throughput. Multithreading is achieved using the
Thread class or the Runnable interface.

8. Applet
An applet in Java is a small program that runs within a web browser, typically used to provide
interactive content, such as games, animations, or multimedia presentations. Applets are written
in Java and are executed by the Java Virtual Machine (JVM) within the browser.

9. AWT (Abstract Window Toolkit)


AWT (Abstract Window Toolkit) is a Java package that provides a set of classes and interfaces
for creating graphical user interfaces (GUIs), including windows, buttons, labels, and text fields.
AWT is a platform-independent API that allows Java programs to create GUIs that are
compatible with multiple operating systems.

10. Frames
A frame in Java is a top-level window that can contain other GUI components, such as buttons,
labels, and text fields. Frames are created using the Frame class and can be used to create
standalone GUI applications or applets. Frames can be customized with various attributes, such
as title, size, and layout.

Here are the basic definitions for each of the topics:

1. Method Overloading
Method overloading in Java is a feature that allows multiple methods with the same name to be
defined, but with different parameter lists. The method that gets called is determined by the
number and types of arguments passed to it.

2. Constructor
A constructor in Java is a special method that is used to initialize objects when they are created.
Constructors have the same name as the class and do not have a return type.

3. Constructor Overloading
Constructor overloading in Java is a feature that allows multiple constructors with the same
name to be defined, but with different parameter lists. The constructor that gets called is
determined by the number and types of arguments passed to it.

4. Inheritance
Inheritance in Java is a mechanism that allows one class to inherit the properties and behavior
of another class. The inheriting class is called the subclass, and the class being inherited from is
called the superclass.

5. Single Inheritance
Single inheritance in Java is a type of inheritance where a subclass inherits from only one
superclass.

6. Multilevel Inheritance
Multilevel inheritance in Java is a type of inheritance where a subclass inherits from a
superclass, and the superclass also inherits from another superclass.

7. Hierarchical Inheritance
Hierarchical inheritance in Java is a type of inheritance where multiple subclasses inherit from
the same superclass.
8. Multiple Inheritance
Multiple inheritance in Java is not supported directly, but it can be achieved using interfaces.
Multiple inheritance is a type of inheritance where a subclass inherits from multiple
superclasses.

9. Class
A class in Java is a blueprint or template that defines the properties and behavior of an object.

10. Object
An object in Java is an instance of a class, and it has its own set of attributes (data) and
methods (functions).

11. Variable
A variable in Java is a named storage location that holds a value.

12. Package
A package in Java is a collection of related classes and interfaces.

13. Interface
An interface in Java is a abstract class that defines a set of methods that must be implemented
by any class that implements it.

14. Method Overriding


Method overriding in Java is a feature that allows a subclass to provide a different
implementation of a method that is already defined in its superclass.

15. Dynamic Method Dispatch


Dynamic method dispatch in Java is a feature that allows the correct method to be called at
runtime, based on the type of object being referred to.

16. String
A String in Java is a sequence of characters.

17. StringBuffer
A StringBuffer in Java is a mutable sequence of characters.

18. Methods
Methods in Java are blocks of code that perform a specific task.

19. Recursion
Recursion in Java is a programming technique where a method calls itself repeatedly until it
reaches a base case.

20. Command Line Argument


A command line argument in Java is a value that is passed to a program when it is executed
from the command line.

21. Font Class


The Font class in Java is used to represent fonts.

22. Color Class


The Color class in Java is used to represent colors.

23. Scanner Class


The Scanner class in Java is used to get input from the user.

24. Layout
A layout in Java is a way of arranging components in a GUI.

25. Grid Layout


A grid layout in Java is a type of layout that arranges components in a grid of rows and columns.

26. Label
A label in Java is a GUI component that displays text.

27. TextField
A text field in Java is a GUI component that allows the user to enter text.

28. TextArea
A text area in Java is a GUI component that allows the user to enter multiple lines of text.

29. CheckBox
A check box in Java is a GUI component that allows the user to select or deselect an option.

30. CheckBoxGroup
A check box group in Java is a group of check boxes that can be selected or deselected
together.

31. Button
A button in Java is a GUI component that can be clicked to perform an action.

32. List
A list in Java is a GUI component that displays a list of items.

33. Choice
A choice in Java is a GUI component that allows the user to select one item from a list of items.

Here are the basic definitions:


1. Array
An array in Java is a collection of elements of the same data type stored in contiguous memory
locations. Arrays are used to store multiple values in a single variable.

2. Multidimensional Array
A multidimensional array in Java is an array that contains one or more arrays as its elements.
Multidimensional arrays are used to represent complex data structures such as matrices and
tables.

3. Bytecode
Bytecode in Java is the intermediate code generated by the Java compiler (javac) when it
compiles Java source code (.java files) into an executable format. Bytecode is
platform-independent and can be executed by any Java Virtual Machine (JVM).

4. JVM (Java Virtual Machine)


The Java Virtual Machine (JVM) is a software program that runs Java bytecode on a computer.
The JVM provides a platform-independent environment for executing Java programs, allowing
Java code to be run on any device that has a JVM, regardless of the underlying operating
system or hardware architecture.

5. Applet
An applet in Java is a small program that runs within a web browser. Applets are used to
provide interactive content, such as games, animations, and multimedia presentations, on web
pages.

6. Applet Methods
Applet methods are special methods in Java that are used to control the execution of an applet.
The most common applet methods are:

- `init()`: Initializes the applet.


- `start()`: Starts the applet.
- `stop()`: Stops the applet.
- `destroy()`: Destroys the applet.

7. Thread Priorities
Thread priorities in Java are used to determine the order in which threads are executed by the
JVM. Threads with higher priorities are executed before threads with lower priorities. There are
three types of thread priorities in Java:

- `MIN_PRIORITY`: The minimum priority that a thread can have.


- `NORM_PRIORITY`: The normal priority that a thread has by default.
- `MAX_PRIORITY`: The maximum priority that a thread can have.
In Java, thread priorities are represented by integer values, with higher values indicating higher
priorities. Here are the thread priority values:

Thread Priority Values


1. *MIN_PRIORITY*: 1
2. *NORM_PRIORITY*: 5
3. *MAX_PRIORITY*: 10

These values are defined as constants in the `Thread` class:

- `Thread.MIN_PRIORITY`
- `Thread.NORM_PRIORITY`
- `Thread.MAX_PRIORITY`

You can set the priority of a thread using the `setPriority()` method, passing one of these values
or a custom value between 1 and 10:

```
Thread thread = new Thread();
thread.setPriority(Thread.NORM_PRIORITY);
```

You might also like