UNIT ONE java
UNIT ONE java
UNIT - II :
Creating a class & subclass: -Declaring a class, Naming class, Rules to assign Class
&
Subclass, Creating a new object, Class of an object. Data members: -Declaring
data
member, Naming variables, using class members. Methods: -Using data members,
Invoke a method, passing arguments to a method, calling method. Access
Specifier &
Modifiers: -Public, Private, Protected, Static & Final. Overloading: -Method
overloading, Constructor overloading. Java class library: - Different types of
classes.
Decision making & loops:-If-then-else, Switch,? : operator, While-loop, do-while
loop,
for. Array: -Creating an array, one-dimensional array, two-dimensional array.
String:
String array, string methods. Inheritance: -Single & multiple inheritances
Interfaces:
Defining interfaces, extending interfaces, implementing interfaces.
UNIT - III :
Join Our Telegram Community - Aspire2Learn
Packages: -Java API packages, creating packages, accessing packages, adding a
class to
packages. Import statement: - Introduction & implementation of import
statement.
Applets:-Introduction to Applets & Application, how applets application are
different
creating An applet. Applets life cycle, designing a web page, creating an
executable
applet, running the applet, applet tags, passing a parameter to applet, HTML tag,
Converting applet to application. Threads:-Overview of threads, single & multiple
threads, lift cycle of threads, stopping & blocking threads, working with threads,
priority
to thread, synchronization. Exceptions & Errors:-Introduction, types of error,
exception,
syntax of exception, handling techniques, exception for Debugging.
UNIT - IV :
Event: -Event driven programming, handling an (AWT) events. Graphic class:
Introduction, the graphic classes, drawing & filling of lines, rectangle, circle &
ellipse,
arcs, polygons, text & fonts, creating a font class, font objects, text, coloring
object.
Streams:-Introduction, Abstract stream classes, file input & output.
AWI Applications: -Creating a GUI using AWT toolkit, using component class,
frames.
Components & Control: -Textfield, textarea class, label, button, choice, list,
checkbox,
class, and combo. Menus: -Creating a popup menus. Image: - Type of image,
Properties
of an image, Displaying an image. Layouts: -Using Window Listener interface,
Different
types of Layout, Layout manager, Flow manager, Grid manager. Container: -
Different
types of container (Frame, Dialog, Panel).
Ans –
Types of Operators in Java –
1. Arithmetic Operators
Used to perform mathematical operations.
+ Addition a+b
* Multiplication a*b
/ Division a/b
% Modulus a%b
(Remainder)
Example:
2. Assignment Operators -
Used to assign values to variables.
Operator Description Example
= Assign a = 10
Example:
3. Unary Operators
Used with a single operand.
Operator Description Example
+ Positive value +a
- Negative value -a
Example:
== Equal to a == b
!= Not equal to a != b
Example:
5. Logical Operators
Used to perform logical operations.
Join Our Telegram Community - Aspire2Learn
Operator Description Example
Example:
6. Bitwise Operators
Used for binary operations.
Operator Description Example
| BITWISE OR a|b
~ Bitwise ~a
Complement
Join Our Telegram Community - Aspire2Learn
<< Left Shift a << 2
Example:
7. Ternary(Conditional) Operator -
Short form of if-else statement.
Syntax:
Example:
Example:
------------------------------------------------------------------------------
5. Explain the structure of java program with suitable
example. S[2024,2019,2018].
Ans –
Structure of a Java Program
A Java program follows a specific structure that consists
of various components. Understanding the structure
helps in writing clean and efficient code.
Expected Output
Explanation of Output -
The program prompts the user: "Enter your name:"
If the user enters "John", the program reads the input.
It then prints: "Hello, John! Welcome to Java."
------------------------------------------------------------------------------
6. Explain the concept of typecasting in java.
S[2024,2023],W[2019].
OR
7. Explain with example type casting and conversion in java.
W[2018].
Join Our Telegram Community - Aspire2Learn
Ans –
Definition:
Typecasting in Java is the process of converting one data
type into another. It is used when we need to store a
value of one type into another type of variable.
Example:
Output:
Example:
Output:
Real-World Example
Implicit Casting: Assigning an integer (100) to a double
variable in a shopping cart system.
Output:
1. Simple -
Java syntax is easy to learn and similar to C/C++ but with
simplified memory management.
Join Our Telegram Community - Aspire2Learn
It removes complex features like pointers, multiple
inheritance, and explicit memory allocation (malloc and
free in C).
Example:
Output: Value of a: 10
2. Object-Oriented
Java follows the OOP (Object-Oriented Programming)
principles:
Example:
Join Our Telegram Community - Aspire2Learn
Output: This is a Car
3. Platform-Independent -
Java follows "Write Once, Run Anywhere (WORA)".
Example:
4. Secure -
Example:
6. Multithreaded -
Java supports multitasking by allowing multiple threads
to execute simultaneously.
7. Distributed -
Java can be used in distributed computing, allowing
applications to communicate over a network.
8. High Performance -
Java uses JIT (Just-In-Time Compiler) to convert
bytecode into machine code at runtime, making
execution faster.
10. Portable -
Java applications do not depend on system architecture
(e.g., 32-bit or 64-bit).
------------------------------------------------------------------------------
Aspire2Learn Feedback Form –
- Your Voice, Our Priority