Unit 5, Java Notes
Unit 5, Java Notes
NetBeans IDE
For the development of applications on the Windows, Mac, Linux, and Solaris
operating systems Net Beans platform is best, NetBeans is GUI based free and
open source software. NetBeans helps to developing Java based software
easily, It also support many other language like HTM5 etc.
The user can easily interacts with NetBeans COMPONENTS which helps the
user to design the software, NetBeans components include jlabels, jbuttons,
jtextfields, etc. There are two types of controls –
Child controls – Child controls are controls that are contained within a
container control. Text field, label, button, etc. are a few examples.
Properties –
Properties –
Properties –
Properties –
jPassword Properties
Methods and data members are found in classes. Data members declare inside
the class, it is variable which we are declaring inside the class. In general, data
members are kept secret so that values can only be altered at the discretion of
the class function members. Data members may be private or public. A method
is a function declared inside a class.
Variables are containers used to store the values for some input, intermediate
result or the final result of an operation. The characteristics of a variable are:
• It has a name.
• It is capable of storing values.
• It provides temporary storage.
• It is capable of changing its value during program execution.
Data Types
Data type states the way the values of that type are stored, the operations that
can be done on that type, and the range for that type.
Numeric Data Types –
These data types are used to store integer values only i.e. whole numbers
only. The storage size and range is listed below:
These data types are used to store numbers having decimal points i.e. they
can store numbers having fractional values.
These data types are used to store characters. Character data types can store
any type of values – numbers, characters and special characters. The char
data type value is always enclosed inside ” (single quotes), whereas a string
data type value is enclosed in “” (double quotes).
Operators
Operators are symbols that manipulate, combine or compare variables. The
operators available in java are summarized below –
Assignment Operator
One of the most common operators is the assignment operator “=” which is
used to assign a value to a variable. The value on the right hand side can be a
number or an arithmetic expression.
For example:
int sum = 0;
int prime = 4*5;
Arithmetic Operators
+ additive operator
– subtraction operator
* multiplication operator
/ division operator
% remainder operator
Relational Operator
A relational operator is used to test for some kind of relation between two
entities.
Logical Operator
Bitwise Operator
Bitwise operators can be used to change a number’s individual bits. They are
compatible with all integral kinds (char, short, int, etc). They are utilised while
updating and searching a binary indexed tree.
1. Select New Project from the File menu. You can also click the New Project
button in the IDE toolbar.
2. In the Categories pane, select the General node. In the Projects pane,
choose the Java Application type. Click the Next button.
3. Enter the name of the project in the Project Name field and specify the
project location. Do not create a Main class here.
4. Click the Finish button.
b. Child controls – Child controls are controls that are positioned inside a
container control. For instance, a text field, a label, a button, etc.
5. What is Methods?
Answer – To do some action on the object, methods are employed. For
instance, you may use a textfield’s setText() method to show something in it or
use its getText() method to retrieve its contents. Getters and setters are the
two categories into which methods can be separated.
6. What is Event?
Answer – Events are the actions which are performed on controls. Examples
of events are mouseClick, mouseMoved,keyPressed etc. When the user
performs any action on a control, an event happens and that event invokes
the corresponding part of the code and the application behaves accordingly.
13. What is Data types? What are the different type of Data Type.
Answer – The data type describes the actions that may be performed on the
type, the range for the type, and how the type’s values are stored. Some of
the example of data types are –
a. Numeric Data Type – These data types are used to store integer values
only i.e. whole numbers only.
Example Byte, Short, Int, Long
b. Floating Data Types – These data types are used to store numbers having
decimal points i.e. they can store numbers having fractional values. for
example float & double.
c. Character Data Types – These data types are used to store characters.
Character data types can store any type of values – numbers, characters and
special characters.