Inventory File Java
Inventory File Java
On
I hereby certify that “STUDENT NAME” Roll No. ……… of BHAI GURDAS
INSTITUTE OF ENGINEERING AND TECHNOLOGY has undergone six months
industrial training from 1st August to ………. our organization to fulfill the requirements
for the award of degree of B.Tech.(7th Sem). He works on ‘Project Name’ project
during the training under the supervision of Er. Divya Goyal.
During his tenure with us we found him/her sincere and hardworking. Wishing him a
great success in the future.
Er.Divya Goyal
ACKNOWLEDGEMENT
The authors are highly grateful to the Director Tanuja Srivastava, BHAI GURDAS
INSTITUTE OF ENGINEERING AND TECHNOLOGY, for providing this opportunity to
carry out the six months industrial training at Pro-Ace InfoTech Company, Patiala
Without the wise counsel and able guidance, it would have been impossible to complete
the report in this manner. The help rendered by Er.Divya Goyal, Supervisor
Trainer for experimentation is greatly acknowledged.
The authors express gratitude to other faculty members of BHAI GURDAS INSTITUTE OF
ENGINEERING AND TECHNOLOGY, for their intellectual support throughout the course
of this work.
Student Name
(University Roll No.)
INDEX
3. History
4. Advantages
5. Features
6. Role of Java
7. Applications of Java
8. Scope
9. Versions of Java
22. ParseInt
23. Array
30. Recursion
35. NetBeans
48. Bibliography
COMPANY PROFILE
PRO-ACE INFOTECH is an ISO 9001:2008 certified organization which has been working
in the field of IT, Embedded System Engineering since last 12 years and has been providing
its clients with exceptional quality in Web Designing, Web Development and SEO services.
We also provide the offshore companies of Australia, US and UK with quality services in the
field of Android Application Development, Embedded Systems, Web Design, Web
Development (PHP), SEO, JAVA
SE Division of the company is running under the name SPEAKSOFT. It is a unit of PRO-
ACE INFOTECH, committed to provide grooming ground to the budding professionals to
grab key positions in the esteemed organizations. Our solutions are aligned with the client’s
requirements keeping in focus the demands of the organizations. Our team is highly
qualified; specialists facilitate the learning and development of new and existing skills in
order to enhance the growth potential of students with respect to English Language and Soft
Skills Training.
COMPANY OVERVIEW
PRO-ACE INFOTECH is an ISO 9001:2008 certified organization established in 2010 which
has been working in the field of information technology since last 12 years and has been
providing its clients with exceptional quality in Web Designing, Web Development and SEO
services.
Company Size : 20
Website : http://www.proaceinfotech.org
Java Technologies
J2EE, EJB, JSP, J2ME, Servlet, SOAP, Web Services, XML, STRUTS, Spring, Hibernate,
Tapestry
Microsoft Technologies
.NET Framework, ASP.NET, VB.NET, C#.NET, Web Services, SQL Services, Dot NET
Nuke (DNN)
Databases
Oracle 10g, Microsoft SQL Server, Db2, MySQL
PHP Technologies
PHP, JavaScript, Joomla, CakePHP, Drupal, Magneto, Ruby on Rails, MySQL
Operating System
Window 7, Window 8, XP, Red Hat Linux, Solaris
Mobile Technologies
MS Window Mobile, J2ME, Windows CE, Symbian, iPhone, Google Android
Its Clients:
Indian Industries
Indian Colleges/Universities
Offshore Clients
Its Divisions:
Development Division
Design Division
Learning Division
HR Division
Development Division
PRO-ACE INFOTECH is a 12 years young organization with an ISO Certification which
has been working in the field of IT, Embedded System Engineering and has been providing
its clients with exceptional quality in Web Designing, Web Development and SEO services.
This company also provide the offshore companies of Australia, US and UK. It is an
association which is functioning in the field of Android Application Development,
Embedded Systems, Web Design, Web Development - PHP, SEO, JAVA.
Learning Division
Learning Division of PRO-ACE INFOTECH is a renowned Engineer Training Division, well
known for providing technical and professional skill training to individuals, organizations
and educational institutions in advance fields such as PHP, J2EE, EMBEDDED SYSTEMS,
AutoCAD. Currently these are the largest job-providing sectors. We provide high end
training with comprehensive programs that integrate all aspects required to excel at the
corporate level. With a combination of vast industry experience, cutting-edge infrastructure,
evolving technological tools and a thorough corporate culture, it function to transform an
individual into a success story.
Se Division (Speaksoft)
SE Division of the company is running under the name SPEAKSOFT. It is a unit of PRO-
ACE INFOTECH, committed to provide grooming ground to the budding professionals to
grab key positions in the esteemed organizations. Its solutions are aligned with the client’s
requirements keeping in focus the demands of the organizations. Its team is highly qualified;
specialists facilitate the learning and development of new and existing skills in order to
enhance the growth potential of students with respect to English Language and Soft Skills
Training. The company partner with us to create and realize our visions and add
tangible value to the students.
Most employers these days want to hire, retain and promote people who are dependable,
resourceful, ethical, and self-directed, have effective communication, are willing to work and
learn and have a positive attitude. The Indian market is also becoming global, so the
attributes of soft skills become imperative to be imbibed by the youth to show their real
potential at intra and international levels.
SPEAKSOFT has designed Skill Enhancement Program for addressing these needs of the
students who are pursuing technical and professional courses. The company have divided the
Skill Enhancement Program under three main heads according to the requirement of the
clients.
Personality development
Image building
Interview skills
Business writing
Time management
Mental aptitude
Brief description of the Skill Enhancement Program
LEVEL 1 LEVEL 2
On On
Aspiring High
Be better equipped to set the sails ‘right’ in the direction of the opportune wind! We all
aspire high to reach our goals which we have set in for ourselves. We all have dreams
and want to achieve our goals. So, what are you waiting for set your seat belts tight and
set in on a journey with us where all your dreams will come true. Let’s collectively work
to bridge the gap between your aspirations and reality. We at PRO-ACE, render our
services to develop corporate solutions that ‘work’ towards strengthening the brand
value and identity.
Nurturing Dreams
The world is turning into a global village and competition is increasing manifolds. There
are many pre-requisites which have to be analyzed and given due consideration to
become successful and reach the goals. At Pro – Ace offer a solution to all the problems
which the students encounter. Pro – Ace has explored all the major issues which become
a hindrance in the student’s career. The organisation have designed our program
“NUTURING DREAMS” which covers all the essential aspects which are required for
cracking the placement process of any company.
Objectives of The Program
Help students understand the benefits of Personality enhancement and Image
Building.
To improve the communication of the students and guide them to organize and
express their ideas effectively.
To comprehend the Pronunciation and understand the standard EnglishTo confidently speak
in front of all and remove the fear of judgment
To acquaint the students with business and professional writing
To build the aptitude skills of students
Enhance logical reasoning
Course Outcomes
Students will be able to handle situations confidently
They will not feel hesitant while using the International language i.e. English
It will boost the morale of the students
Students will become good communicators, self-motivated and ambitious
Have a clear vision and overcome obstacles
Methodology
Open Discussions Individually and in groups
Group activities
Games and relevant activities
Power point presentations
Perception tasks
One of Java's key features is its "write once, run anywhere" principle, which means that Java
programs can run on any device or operating system that has a Java Virtual Machine (JVM)
installed. This platform independence is achieved by compiling Java source code into
bytecode, which can then be executed by the JVM.
Java is an object-oriented language, which means it supports the concepts of classes and
objects. It provides a rich set of features for object-oriented programming, such as
inheritance, encapsulation, and polymorphism. This allows developers to create modular and
reusable code, making it easier to build and maintain complex applications.
Furthermore, Java has a vast standard library that provides a wide range of classes and
methods for common programming tasks, such as input/output operations, networking, and
database connectivity. Additionally, there is a thriving ecosystem of third-party libraries and
frameworks that further enhance Java's capabilities and make development more efficient.
History
Java's history dates back to the early 1990s when a team of developers at Sun
Microsystems, led by James Gosling, started working on a project called "Green." The
goal of the project was to develop a language that could be used to program consumer
electronics, such as set-top boxes.
Initially, the team developed a language called Oak, which was later renamed Java due to
trademark conflicts. The name "Java" was inspired by the coffee consumption habits of
the development team. The language was designed to be simple, portable, and secure,
with built-in support for networking and distributed computing.
In 1995, Sun Microsystems officially released Java to the public. The release included the
Java Development Kit (JDK) 1.0, which consisted of the Java compiler, the Java Virtual
Machine (JVM), and a set of libraries. Java's key feature, the "write once, run anywhere"
principle, was made possible by the JVM, which could execute bytecode on any platform.
Java gained popularity quickly, particularly in the realm of web development. Applets,
which were small Java programs embedded in webpages, allowed for interactive and
dynamic content on the early web. However, as the web evolved, the usage of Java
applets declined due to security concerns and the emergence of alternative technologies.
In the late 1990s, Java began to gain significant traction in enterprise software
development. Its object-oriented nature, extensive libraries, and platform independence
made it an ideal choice for building large-scale applications. The Java 2 Platform,
Standard Edition (J2SE), introduced in 1998, brought important updates and
improvements to the language.
In 2006, Sun Microsystems released Java as an open-source project under the GNU
General Public License (GPL). This move helped to further expand Java's reach and
fostered a strong community around the language. Oracle Corporation acquired Sun
Microsystems in 2010 and became the custodian of Java.
Java's popularity has remained strong, and it has maintained its position as one of the
most widely used programming languages. It has found applications in various domains,
including web development, mobile app development (particularly for Android),
enterprise software development, scientific computing, and more.
Advantages
1. Simple
Java is a simple programming language since it is easy to learn and easy to understand. Its
syntax is based on C++, and it uses automatic garbage collection; therefore, we don't need to
remove the unreferenced objects from memory. Java has also removed the features like
explicit pointers, operator overloading, etc., making it easy to read and write.
2. Object-Oriented
Java uses an object-oriented paradigm, which makes it more practical. Everything in Java is
an object which takes care of both data and behavior. Java uses object-oriented concepts like
object, class, inheritance, encapsulation, polymorphism, and abstraction.
3. Secured
Java is a secured programming language because it doesn't use Explicit pointers. Also, Java
programs run inside the virtual machine sandbox. JRE also provides a classloader, which is
used to load the class into JVM dynamically. It separates the class packages of the local file
system from the ones that are being imported from the network.
4. Robust
Java is a robust programming language since it uses strong memory management. We can
also handle exceptions through the Java code. Also, we can use type checking to make our
code more secure. It doesn't provide explicit pointers so that the programmer cannot access
the memory directly from the code.
5. Platform independent
Java code can run on multiple platforms directly, I.e., we need not compile it every time. It is
right once, runs anywhere language (WORA) which can be converted into byte code at the
compile time. The byte code is a platform-independent code that can run on multiple
platforms.
6. Multi-Threaded
Java uses a multi-threaded environment in which a bigger task can be converted into various
threads and run separately. The main advantage of multi-threading is that we need not
provide memory to every running thread.
1. Object Oriented:
In Java, everything is an Object. Java can be easily extended since it is based on the
Object model.
2. Simple:
Java is designed to be easy to learn. If you understand the basic concept of OOP Java, it
would be easy to master.
3. Secure:
With Java's secure feature it enables to develop virus-free, tamper-free systems.
Authentication techniques are based on public-key encryption.
4. Platform Independent:
Unlike many other programming languages including C and C++, when Java is
compiled, it is not compiled into platform specific machine, rather into platform-
independent byte code. This byte code is distributed over the web and interpreted by the
Virtual Machine (JVM) on whichever platform it is being run on.
5. Robust:
Java makes an effort to eliminate error-prone situations by emphasizing mainly on
compile time error checking and runtime checking.
6. Portable:
Being architecture-neutral and having no implementation dependent aspects of the
specification makes Java portable. The compiler in Java is written in ANSI C with a
clean portability boundary, which is a POSIX subset.
7. Architecture-neutral:
Java compiler generates an architecture-neutral object file format, which makes the
compiled code executable on many processors, with the presence of Java runtime
system.
8. Dynamic:
Java is considered to be more dynamic than C or C++ since it is designed to adapt to an
evolving environment. Java programs can carry an extensive amount of run-time
information that can be used to verify and resolve accesses to objects at run-time.
9. Interpreted:
Java byte code is translated on the fly to native machine instructions and is not stored
anywhere. The development process is more rapid and analytical since the linking is an
incremental and light-weight process.
11. Multithreaded:
With Java's multithreaded feature it is possible to write programs that can perform many
tasks simultaneously. This design feature allows the developers to construct interactive
applications that can run smoothly.
12. Distributed:
Java is designed for the distributed environment of the internet.
Role of Java
Java plays a significant role in various domains and has become a fundamental
technology in the software development industry. Here are some key roles that Java
fulfills:
Video games:
When it comes to game development, programming languages such as C# and C++ are
employed by game engines such as Unity and Unreal Engine. Java, on the other hand, is
a great choice if you want to study graphics and game development from the ground up.
There are numerous frameworks and libraries available, such as LibGDX and OpenGL.
Web-based programmes:
Java is a well-known server-side programming language that is often used for
constructing web applications. Spring, Struts, Hibernate, Apache Hadoop, and JSF are
among of the most popular Java frameworks for constructing Web applications. Java is
also used by famous websites such as LinkedIn, AliExpress, Amazon, and many others.
Big data:
Aside from Python, which is used in Big Data, there are many other popular
programming languages. Even so, when it comes to Big Data Technology, most
programmers prefer Java. The reason for this is that most famous Big Data tools, such as
Hadoop and Deeplearning4j, use Java and its community support is excellent when it
comes to Big Data Technology.
Android apps:
Java is the official programming language for Android development, with Java
accounting for 46.2 percent of all Android applications. It’s used by Android Studio,
which is the official IDE for developing Android apps. So, if you are familiar with the
Java programming language, Android development will be considerably easier for you.
Desktop applications:
Java is also well-known for creating graphical user interfaces for desktop applications.
There are numerous Java Frameworks available, making GUI Application Development
a breeze. Swing, AWT, JavaFX, Griffon, and many others are among them. So, if you’re
planning to create a desktop application, Java is a great option for you.
Applications of Java
3. Web-based Applications:
It is also used for developing the web-based application because it provides vast support
for web development through Servlet, JSP, and Struts. It is the reason that Java is also
known as a server-side programming language. Using these technologies, we can develop
a variety of applications. The most popular frameworks Spring, Hibernate, Spring Boot,
used for developing web-based applications. LinkedIn, AliExpress, web.archive.org,
IRCTC, etc. are the popular websites that are written using Java programming language.
4. Game Development:
Java is widely used by game development companies because it has the support of the
open-source most powerful 3D engine. The engine provides unparalleled capacity when it
comes to the context of the designing of 3D games. The most popular games developed in
Java are Minecraft, Mission Impossible III, etc. There are some popular Frameworks and
Libraries available for Game Development, like - LibGDX and OpenGL.
6. Distributed Applications:
The JINI (Java Intelligent Networking Infrastructure) provides the infrastructure to
register and find distributed services based on its specification. It implements a
mechanism that is known as JavaSpaces. It supports the distribution, persistence, and
migration of objects in a network.
7. Cloud-Based Applications:
A cloud application is the on-demand availability of IT resources via the internet. The
cloud-based application provides the service at a low cost. Java provides the environment
to develop cloud-based applications. We can use Java to develop SaaS (Software as a
Service), LaaS (Logging as a Service), and PaaS (Platform as a Service). The cloud
application widely used to share data between companies or to develop applications
remotely.
8. IoT Application:
IoT is a technology that connects the devices in its network and communicates with them.
IoT has found almost in all the small devices such as health gears, smartphones,
wearables, smart lighting, TVs, etc. For developing the IoT application there is a lot of
programming languages that can be used but Java offers an edge to developers that is
unparalleled. IoT programmers gravitate towards Java because of its security, flexibility,
and versatility.
Scope
The scope of Java remains strong and promising in the software development industry. Here
are some key factors that contribute to the continued scope and relevance of Java:
1. Wide Adoption:
Java is one of the most widely adopted programming languages in the world. It has a
vast and active developer community, which ensures a steady supply of resources,
frameworks, libraries, and tools. The extensive adoption of Java ensures a high demand
for Java developers and opportunities for career growth.
2. Enterprise Applications:
Java has a strong foothold in the development of enterprise-level applications. Its
scalability, robustness, and support for distributed computing make it an ideal choice
for building large-scale, mission-critical software systems. The need for enterprise
applications is likely to persist, ensuring a steady demand for Java developers with
enterprise development skills.
3. Android Development:
Java is the primary programming language for Android app development. Android has
a massive market share in the mobile industry, and Java remains essential for building
Android applications. As mobile app usage continues to grow, the demand for skilled
Java developers in the Android ecosystem will remain significant.
6. Cloud Computing:
Java is extensively used in cloud computing platforms and technologies. Many cloud-
based services, including serverless computing, containerization, and microservices
architectures, rely on Java. As more organizations adopt cloud technologies, the
demand for Java developers with cloud computing skills is likely to grow.
Versions of Java
Java had several major versions, each with its own set of features and improvements. Here
are some of the major versions of Java up to Java 16:
Java 1.0 (January 23, 1996): The first official release of Java, introducing the core
language features and libraries.
Java 1.1 (February 19, 1997): Added significant improvements, including inner classes
and JavaBeans.
Java 1.2 (Java 2 Platform, Standard Edition 1.2) (December 8, 1998): Introduced the
Java Collections Framework, Swing GUI toolkit, and the Java Plug-in.
Java 1.3 (Java 2 Platform, Standard Edition 1.3) (May 8, 2000): Added the HotSpot
JVM, an XML parser, and the Java Sound API.
Java 1.4 (Java 2 Platform, Standard Edition 1.4) (February 6, 2002): Brought
improvements like assert keyword, regular expressions, and the Java Web Start.
Java 5 (Java 2 Platform, Standard Edition 5.0) (September 30, 2004): Introducing major
features like Generics, Annotations, Enumerations, and Autoboxing/Unboxing.
Java 7 (Java Platform, Standard Edition 7) (July 28, 2011): Introduced features like the
try-with-resources statement, strings in switch, and the Fork/Join Framework.
Java 8 (Java Platform, Standard Edition 8) (March 18, 2014): A significant release with
features like Lambda expressions, Stream API, and Date/Time API.
Java 9 (Java Platform, Standard Edition 9) (September 21, 2017): Introduces the
modular system (Project Jigsaw), the Flow API, and the Process API improvements.
Java 10 (Java Platform, Standard Edition 10) (March 20, 2018): Introduced local-
variable type inference (var keyword) and other minor enhancements.
Java 11 (Java Platform, Standard Edition 11) (September 25, 2018): Long-Term Support
(LTS) version, removed some deprecated APIs, and introduced new features.
Java 12 (Java Platform, Standard Edition 12) (March 19, 2019): Brought improvements
like switch expressions and enhancements to the Garbage Collector.
Java 13 (Java Platform, Standard Edition 13) (September 17, 2019): Introduced new
features like text blocks and enhancements to the Z Garbage Collector.
Java 14 (Java Platform, Standard Edition 14) (March 17, 2020): Added features like
pattern matching for instanceof, records, and more.
Java 15 (Java Platform, Standard Edition 15) (September 15, 2020): Introduced Sealed
Classes, hidden classes, and Text Blocks enhancements.
Java 16 (Java Platform, Standard Edition 16) (March 16, 2021): Introduced features like
JEP 338: Vector API (Incubator) and JEP 395: Records.
Datatypes of Java
Data types specify the different sizes and values that can be stored in the variable. There
are two types of data types in Java:
Primitive data types: The primitive data types include boolean, char, byte, short, int,
long, float and double.
Non-primitive data types: The non-primitive data types include Classes, Interfaces,
and Arrays.
Syntax:
boolean booleanVar;
Size: Virtual machine dependent
Syntax:
short shortVar;
Size: 2 bytes (16 bits)
Syntax:
int intVar;
Size: 4 bytes ( 32 bits )
Remember: In Java SE 8 and later, we can use the int data type to represent an unsigned 32-
bit integer, which has a value in the range [0, 232-1]. Use the Integer class to use the int data
type as an unsigned integer.
Syntax:
long longVar;
Remember: In Java SE 8 and later, you can use the long data type to represent an unsigned
64-bit long, which has a minimum value of 0 and a maximum value of 264-1. The Long class
also contains methods like comparing Unsigned, divide Unsigned, etc to support arithmetic
operations for unsigned long.
Syntax:
float floatVar;
Syntax:
double doubleVar;
Note: Both float and double data types were designed especially for scientific calculations,
where approximation errors are acceptable. If accuracy is the most prior concern then, it is
recommended not to use these data types and use BigDecimal class instead.
Syntax:
char charVar;
The Reference Data Types will contain a memory address of variable values because the
reference types won’t store the variable value directly in memory. They are strings, objects,
arrays, etc.
1. Strings
Strings are defined as an array of characters. The difference between a character array and a
string in Java is, that the string is designed to hold a sequence of characters in a single
variable whereas, a character array is a collection of separate char-type entities. Unlike C/C+
+, Java strings are not terminated with a null character.
2. Class
A class is a user-defined blueprint or prototype from which objects are created. It represents
the set of properties or methods that are common to all objects of one type. In general, class
declarations can include these components, in order:
Modifiers: A class can be public or has default access. Refer to access specifiers for classes
or interfaces in Java
Class name: The name should begin with an initial letter (capitalized by convention).
Superclass(if any): The name of the class’s parent (superclass), if any, preceded by the
keyword extends. A class can only extend (subclass) one parent.
Interfaces(if any): A comma-separated list of interfaces implemented by the class, if any,
preceded by the keyword implements. A class can implement more than one interface.
Body: The class body is surrounded by braces, { }.
3. Object
An Object is a basic unit of Object-Oriented Programming and represents real-life entities. A
typical Java program creates many objects, which as you know, interact by invoking
methods. An object consists of :
4. Interface
Like a class, an interface can have methods and variables, but the methods declared in an
interface are by default abstract (only method signature, no body).
Interfaces specify what a class must do and not how. It is the blueprint of the class.
An Interface is about capabilities like a Player may be an interface and any class
implementing Player must be able to (or must implement) move(). So it specifies a set of
methods that the class has to implement.
If a class implements an interface and does not provide method bodies for all functions
specified in the interface, then the class must be declared abstract.
A Java library example is Comparator Interface. If a class implements this interface, then it
can be used to sort a collection.
5. Array
An Array is a group of like-typed variables that are referred to by a common name. Arrays in
Java work differently than they do in C/C++. The following are some important points about
Java arrays.
Characters are the smallest units (elements) of Java language that are used to write Java
tokens. These characters are defined by the Unicode character set.
A character set in Java is a set of alphabets, letters, and some special characters that are valid
in java programming language.
The first character set used in the computer system was US-ASCII (American Standard Code
for Information Interchange (ASCII pronounced as ass-kee)). It is limited to represent only
American English.
US-ASCII consists of uppercase and lowercase Latin alphabets, numerals, punctuation, a set
of control codes, and a few miscellaneous symbols.
Unicode defines a standardized 16-bit character coding system. It currently supports more
than 34,000 defined characters derived from 24 languages from America, Europe, Middle
East, Africa, and Asia (including India).
However, we use mostly basic ASCII characters to develop a program that includes letters,
digits, and punctuation marks used in normal English.
Java language uses the character sets as the building block to form the basic elements such as
identifiers, variables, array, etc in the program. These are as follows:
Letters: Both lowercase (a, b, c, d, e, etc.) and uppercase (A, B, C, D, E, etc.) letters.
Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
Special symbols: _, (, ), {, }, [, ], +, -, *, /, %, !, &, |, ~, ^, <, =, >, $, #, ?, Comma (,), Dot (.),
Colon (:), Semi-colon (;), Single quote (‘), Double quote (“), Back slash (\).
White space: Space, Tab, New line.
Unicode represents a standardized and universal character set that can be extended to
accommodate additions.
When the program source code file encoding does not support Unicode in Java, we can define
Unicode characters as escape sequences by using the notation \uXXXX, where XXXX
specifies the character’s 16-bit representation in hexadecimal.
1. Keywords
2. Identifiers
3. Constants
4. Special Symbols
5. Operators
2. Identifiers: Identifiers are used as the general terminology for naming of variables,
functions and arrays. These are user-defined names consisting of an arbitrarily long
sequence of letters and digits with either a letter or the underscore(_) as a first character.
Identifier names must differ in spelling and case from any keywords. You cannot use
keywords as identifiers; they are reserved for special use. Once declared, you can use the
identifier in later program statements to refer to the associated value. A special kind of
identifier, called a statement label, can be used in goto statements.
Examples of valid identifiers :
MyVariable
MYVARIABLE
myvariable
x
i
x1
i1
_myvariable
$myvariable
sum_of_array
geeks123
Examples of invalid identifiers :
3. Constants/Literals: Constants are also like normal variables. But, the only difference
is, their values can not be modified by the program once they are defined. Constants refer
to fixed values. They are also called as literals.
Constants may belong to any of the data type.
Syntax:
4. Special Symbols: The following special symbols are used in Java having some special
meaning and thus, cannot be used for some other purpose.
[] () {}, ; * =
Brackets[]: Opening and closing brackets are used as array element reference. These
indicate single and multidimensional subscripts.
Parentheses(): These special symbols are used to indicate function calls and function
parameters.
Braces{}: These opening and ending curly braces marks the start and end of a block
of code containing more than one executable statement.
comma (, ): It is used to separate more than one statements like for separating
parameters in function calls.
semi colon : It is an operator that essentially invokes something called an initialization
list.
asterick (*): It is used to create pointer variable.
assignment operator: It is used to assign values.
5. Operators: Java provides many types of operators which can be used according to the
need. They are classified based on the functionality they provide. Some of the types are-
Arithmetic Operators
Unary Operators
Assignment Operator
Relational Operators
Logical Operators
Ternary Operator
Bitwise Operators
Shift Operators
instance of operator
Precedence and Associativity
class Main
{
public static void main(String[] args)
{
System.out.println("Hello World");
}
}
For now, just remember that every Java program has a class name which must match the
filename, and that every program must contain the main() method.
System.out.println()
Inside the main() method, we can use the println() method to print a line of text to the screen:
Type casting is a method or process that converts a data type into another data type in both
ways manually and automatically. The automatic conversion is done by the compiler and
manual conversion performed by the programmer. In this section, we will discuss type
casting and its types with proper examples.
WideningTypeCastingExample.java
Output:
Before conversion, the value is: 7
After conversion, the long value is: 7
After conversion, the float value is: 7.0
In the above example, we have taken a variable x and converted it into a long type. After that,
the long type is converted into the float type.
double -> float -> long -> int -> char -> short -> byte
Let's see an example of narrowing type casting.
In the following example, we have performed the narrowing type casting two times. First, we
have converted the double type into long data type after that long data type is converted into
int type.
NarrowingTypeCastingExample.java
Output:
Before conversion: 166.66
After conversion into long type: 166
After conversion into int type: 166
Syntax
It also converts the Bytes (from the input stream) into characters using the platform's default
charset.
Method Description
int nextInt() It is used to scan the next token of the input as an
integer.
float nextFloat() It is used to scan the next token of the input as a float.
double nextDouble() It is used to scan the next token of the input as a
double.
byte nextByte() It is used to scan the next token of the input as a byte.
String nextLine() Advances this scanner past the current line.
boolean nextBoolean() It is used to scan the next token of the input into a
boolean value.
long nextLong() It is used to scan the next token of the input as a long.
short nextShort() It is used to scan the next token of the input as a Short.
BigInteger nextBigInteger() It is used to scan the next token of the input as a
BigInteger.
BigDecimal nextBigDecimal() It is used to scan the next token of the input as a
BigDecimal.
Program:
import java.util.Scanner;
class UserInputDemo
{
public static void main(String[] args)
{
Scanner sc= new Scanner(System.in); //System.in is a standard input st
ream
System.out.print("Enter first number- ");
int a= sc.nextInt();
System.out.print("Enter second number- ");
int b= sc.nextInt();
System.out.print("Enter third number- ");
int c= sc.nextInt();
int d=a+b+c;
System.out.println("Total= " +d);
}
}
Output:
Operators in Java
Operators in Java are the symbols used for performing specific operations in Java.
Operators make tasks like addition, multiplication, etc which look easy although the
implementation of these tasks is quite complex.
1. Arithmetic Operators
2. Unary Operators
3. Assignment Operator
4. Relational Operators
5. Logical Operators
6. Ternary Operator
7. Bitwise Operators
8. Shift Operators
9. instance of operator
1. Arithmetic Operators
They are used to perform simple arithmetic operations on primitive data types.
* : Multiplication
/ : Division
% : Modulo
+ : Addition
– : Subtraction
Example:
// Drive Class
class GFG {
// Main Function
public static void main (String[] args) {
// Arithmetic operators
int a = 10;
int b = 3;
}
}
Output:
Addition:30
Substraction:10
Multiplication:200
Division:2
2. Unary Operators
Unary operators need only one operand. They are used to increment, decrement, or negate a
value.
Example:
// Driver Class
class GFG {
// main function
public static void main(String[] args)
{
// Interger declared
int a = 10;
int b = 10;
Output:
Postincrement : 10
Preincrement : 12
Postdecrement : 10
Predecrement : 8
3. Assignment Operator
‘=’ Assignment operator is used to assign a value to any variable. It has right-to-left
associativity, i.e. value given on the right-hand side of the operator is assigned to the variable
on the left, and therefore right-hand side value must be declared before using it or should be a
constant.
variable = value;
In many cases, the assignment operator can be combined with other operators to build a
shorter version of the statement called a Compound Statement. For example, instead of a =
a+5, we can write a += 5.
+=, for adding the left operand with the right operand and then assigning it to the variable on
the left.
-=, for subtracting the right operand from the left operand and then assigning it to the variable
on the left.
*=, for multiplying the left operand with the right operand and then assigning it to the
variable on the left.
/=, for dividing the left operand by the right operand and then assigning it to the variable on
the left.
%=, for assigning the modulo of the left operand by the right operand and then assigning it to
the variable on the left.
Example:
// Driver Class
class GFG {
// Main Function
public static void main(String[] args)
{
// Assignment operators
int f = 7;
System.out.println("f += 3: " + (f += 3));
System.out.println("f -= 2: " + (f -= 2));
System.out.println("f *= 4: " + (f *= 4));
System.out.println("f /= 3: " + (f /= 3));
System.out.println("f %= 2: " + (f %= 2));
System.out.println("f &= 0b1010: " + (f &= 0b1010));
System.out.println("f |= 0b1100: " + (f |= 0b1100));
System.out.println("f ^= 0b1010: " + (f ^= 0b1010));
System.out.println("f <<= 2: " + (f <<= 2));
System.out.println("f >>= 1: " + (f >>= 1));
System.out.println("f >>>= 1: " + (f >>>= 1));
}
}
Output:
f += 3: 10
f -= 2: 8
f *= 4: 32
f /= 3: 10
f %= 2: 0
f &= 0b1010: 0
f |= 0b1100: 12
f ^= 0b1010: 6
f <<= 2: 24
f >>= 1: 12
f >>>= 1: 6
4. Relational Operators
These operators are used to check for relations like equality, greater than, and less than. They
return boolean results after the comparison and are extensively used in looping statements as
well as conditional if-else statements. The general format is,
==, Equal to returns true if the left-hand side is equal to the right-hand side.
!=, Not Equal to returns true if the left-hand side is not equal to the right-hand side.
<, less than: returns true if the left-hand side is less than the right-hand side.
<=, less than or equal to returns true if the left-hand side is less than or equal to the right-hand
side.
>, Greater than: returns true if the left-hand side is greater than the right-hand side.
>=, Greater than or equal to returns true if the left-hand side is greater than or equal to the
right-hand side.
Example:
// Driver Class
class GFG {
// main function
public static void main(String[] args)
{
// Comparison operators
int a = 10;
int b = 3;
int c = 5;
Output:
a > b: true
a < b: false
a >= b: true
a <= b: false
a == c: false
a != c: true
5. Logical Operators
These operators are used to perform “logical AND” and “logical OR” operations, i.e., a
function similar to AND gate and OR gate in digital electronics. One thing to keep in mind is
the second condition is not evaluated if the first one is false, i.e., it has a short-circuiting
effect. Used extensively to test for several conditions for making a decision. Java also has
“Logical NOT”, which returns true when the condition is false and vice-versa
&&, Logical AND: returns true when both conditions are true.
||, Logical OR: returns true if at least one condition is true.
!, Logical NOT: returns true when a condition is false and vice-versa
Example:
// Driver Class
class GFG {
// Main Function
public static void main (String[] args) {
// Logical operators
boolean x = true;
boolean y = false;
Output:
x && y: false
x || y: true
!x: false
Flowchart of Compilation and Interpretation concept
The process begins with the Java source code, which is typically written with a .java
extension.
The Java source code is passed through the Java Compiler (javac). The compiler checks the
syntax and semantics of the code and converts it into an intermediate form known as
bytecode.
The bytecode is saved in a .class file, which contains instructions that can be executed by the
Java Virtual Machine (JVM).
The JVM acts as an interpreter for the bytecode. It reads and executes the bytecode line by
line, translating it into machine code or native code for the underlying system on-the-fly.
The JVM then produces the output of the program based on the bytecode execution or
displays an error message if any issues are encountered during interpretation.
Statements and its types
In Java, a statement is an executable instruction that tells the compiler what to perform. It
forms a complete command to be executed and can include one or more expressions. A
sentence forms a complete idea that can include one or more clauses.
Types of Statements
Java statements can be broadly classified into the following categories:
1. Expression Statements
2. Declaration Statements
3. Control Statements
1. Expression Statements
Expression is an essential building block of any Java program. Generally, it is used to
generate a new value. Sometimes, we can also assign a value to a variable. In Java,
expression is the combination of values, variables, operators, and method calls.
2. Declaration Statements
In declaration statements, we declare variables and constants by specifying their data type
and name. A variable holds a value that is going to use in the Java program. For example:
int quantity;
boolean flag;
String message;
Also, we can initialize a value to a variable. For example:
3. Control Statement
Control statements decide the flow (order or sequence of execution of statements) of a Java
program. In Java, statements are parsed from top to bottom. Therefore, using the control flow
statements can interrupt a particular section of a program based on a certain condition.
Example of Statement
//declaration statement
int number;
//expression statement
number = 412;
//control flow statement
if (number > 10 )
{
//expression statement
System.out.println(number + " is greater than 100");
}
Difference between Break and Continue Statement
In Java, both break and continue are control flow statements used to alter the flow of a loop
(e.g., for, while, do-while) based on specific conditions. However, they serve different
purposes:
Break statement:
Purpose: The break statement is used to terminate the execution of a loop prematurely,
causing the program to exit the loop entirely.
Use case: When a specific condition is met inside the loop, and you want to stop the loop
from further iterations and continue executing the code outside the loop.
Effect: When the break statement is encountered, the control immediately exits the loop, and
the program continues with the code that follows the loop.
Example:
Output: 1 2 3 4
Continue statement:
Purpose: The continue statement is used to skip the rest of the loop's body for the current
iteration when a specific condition is met, and it continues with the next iteration.
Use case: When you want to skip some part of the loop for certain conditions but continue
with the next iteration.
Effect: When the continue statement is encountered, the loop immediately jumps to the next
iteration, and the code below the continue statement for the current iteration is skipped.
Example:
Output: 1 2 4 5
Buffered Reader
In Java, BufferedReader is a class in the java.io package that allows you to read text from a
character-input stream efficiently. It provides buffering capabilities, which means it reads
data from the input stream in chunks and stores them in an internal buffer. This buffering
helps to reduce the number of actual reads from the underlying input stream, leading to
improved performance.
ParseInt
ParseInt is a method in Java that belongs to the Integer class, which is a wrapper class for the
primitive data type int. The purpose of the parseInt method is to parse a String representation
of an integer and convert it into its corresponding int value.
Array
Java array is an object which contains elements of a similar data type. Additionally, The
elements of an array are stored in a contiguous memory location. It is a data structure where
we store similar elements. We can store only a fixed set of elements in a Java array.
Array in Java is index-based, the first element of the array is stored at the 0th index, 2nd
element is stored on 1st index and so on.
Unlike C/C++, we can get the length of the array using the length member. In C/C++, we
need to use the sizeof operator.
In Java, array is an object of a dynamically generated class. Java array inherits the Object
class, and implements the Serializable as well as Cloneable interfaces. We can store primitive
values or objects in an array in Java. Like C/C++, we can also create single dimentional or
multidimentional arrays in Java.
Moreover, Java provides the feature of anonymous arrays which is not available in C/C++.
Advantages
Code Optimization: It makes the code optimized, we can retrieve or sort the data efficiently.
Random access: We can get any data located at an index position.
Disadvantages
Size Limit: We can store only the fixed size of elements in the array. It doesn't grow its size
at runtime. To solve this problem, collection framework is used in Java which grows
automatically.
Output:
10
20
70
40
50
A class is a blueprint or a template for creating objects. It defines the structure and
behavior of objects that will be created based on it. A class contains data members (fields)
and methods that define the properties and actions of the objects of that class.
// Class declaration
public class MyClass {
// Data members (fields)
dataType fieldName1;
dataType fieldName2;
// ...
// Constructor(s)
public MyClass() {
// Constructor code (optional)
}
// Methods
returnType methodName1(parameters) {
// Method body
// ...
return returnValue;
}
returnType methodName2(parameters) {
// Method body
// ...
return returnValue;
}
// ...
}
public: The access modifier specifies the visibility of the class. In this case, it is declared as
public, which means the class can be accessed from any other class.
MyClass: The name of the class, which follows Java naming conventions (usually starts with
an uppercase letter).
dataType: The data type of the fields or the return type of methods.
fieldName1, fieldName2: The names of the data members (fields) in the class.
parameters: The input parameters (if any) that a method can take.
Here's how you can create an object of the class and access its members:
java
Copy code
// Creating an object of MyClass
MyClass myObject = new MyClass();
Using classes and objects is a fundamental concept in Java, allowing you to create reusable
and organized code by encapsulating data and behavior within classes.
Function, also known as method in Java is a collection of instructions that performs a specific
task. It provides the reusability of code. We can also easily modify code using methods. In
this section, we will learn what is a method in Java, types of methods, method declaration,
and how to call a method in Java.
The most important method in Java is the main() method. If you want to read more about the
main() method, go through the link https://www.javatpoint.com/java-main-method.
Method Declaration
The method declaration provides information about method attributes, such as visibility,
return-type, name, and arguments. It has six components that are known as method header, as
we have shown in the following figure.
Method Signature: Every method has a method signature. It is a part of the method
declaration. It includes the method name and parameter list.
Access Specifier: Access specifier or modifier is the access type of the method. It
specifies the visibility of the method. Java provides four types of access specifier:
Public: The method is accessible by all classes when we use public specifier in our
application.
Private: When we use a private access specifier, the method is accessible only in the classes
in which it is defined.
Protected: When we use protected access specifier, the method is accessible within the same
package or subclasses in a different package.
Default: When we do not use any access specifier in the method declaration, Java uses
default access specifier by default. It is visible only from the same package only.
Return Type: Return type is a data type that the method returns. It may have a
primitive data type, object, collection, void, etc. If the method does not return anything,
we use void keyword.
Method Name: It is a unique name that is used to define the name of a method. It must
be corresponding to the functionality of the method. Suppose, if we are creating a method
for subtraction of two numbers, the method name must be subtraction(). A method is
invoked by its name.
Parameter List: It is the list of parameters separated by a comma and enclosed in the
pair of parentheses. It contains the data type and variable name. If the method has no
parameter, left the parentheses blank.
Method Body: It is a part of the method declaration. It contains all the actions to be
performed. It is enclosed within the pair of curly braces.
Naming a Method
While defining a method, remember that the method name must be a verb and start with a
lowercase letter. If the method name has more than two words, the first name must be a verb
followed by adjective or noun. In the multi-word method name, the first letter of each word
must be in uppercase except the first word. For example:
It is also possible that a method has the same name as another method name in the same
class, it is known as method overloading.
Types of Method
There are two types of methods in Java:
1. Predefined Method
2. User-defined Method
1. Predefined Method
In Java, predefined methods are the method that is already defined in the Java class libraries
is known as predefined methods. It is also known as the standard library method or built-in
method. We can directly use these methods just by calling them in the program at any point.
Some pre-defined methods are length(), equals(), compareTo(), sqrt(), etc. When we call any
of the predefined methods in our program, a series of codes related to the corresponding
method runs in the background that is already stored in the library.
Each and every predefined method is defined inside a class. Such as print() method is defined
in the java.io.PrintStream class. It prints the statement that we write inside the method. For
example, print("Java"), it prints Java on the console.
Demo.java
public class Demo
{
public static void main(String[] args)
{
// using the max() method of Math class
System.out.print("The maximum number is: " + Math.max(9,7));
}
}
Output:
In the above example, we have used three predefined methods main(), print(), and max(). We
have used these methods directly without declaration because they are predefined. The print()
method is a method of PrintStream class that prints the result on the console. The max()
method is a method of the Math class that returns the greater of two numbers.
We can also see the method signature of any predefined method by using the link
https://docs.oracle.com/. When we go through the link and see the max() method signature,
we find the following:
Method in Java
In the above method signature, we see that the method signature has access specifier public,
non-access modifier static, return type int, method name max(), parameter list (int a, int b). In
the above example, instead of defining the method, we have just invoked the method. This is
the advantage of a predefined method. It makes programming less complicated.
Similarly, we can also see the method signature of the print() method.
2. User-defined Method
The method written by the user or programmer is known as a user-defined method. These
methods are modified according to the requirement.
import java.util.Scanner;
public class EvenOdd
{
public static void main (String args[])
{
//creating Scanner class object
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number: ");
//reading value from the user
int num=scan.nextInt();
//method calling
findEvenOdd(num);
}
In the above code snippet, as soon as the compiler reaches at line findEvenOdd(num), the
control transfer to the method and gives the output accordingly.
Let's combine both snippets of codes in a single program and execute it.
EvenOdd.java
import java.util.Scanner;
public class EvenOdd
{
public static void main (String args[])
{
//creating Scanner class object
Scanner scan=new Scanner(System.in);
System.out.print("Enter the number: ");
//reading value from user
int num=scan.nextInt();
//method calling
findEvenOdd(num);
}
//user defined method
public static void findEvenOdd(int num)
{
//method body
if(num%2==0)
System.out.println(num+" is even");
else
System.out.println(num+" is odd");
}
}
Output 1:
Output 2:
Garbage collection is a process in Java (and other programming languages with automatic
memory management) that automatically reclaims memory occupied by objects that are no
longer in use or no longer reachable by the application. It helps manage memory efficiently
and ensures that the program does not suffer from memory leaks, where memory is allocated
but never released.
In Java, objects are created dynamically on the heap (a region of memory used for dynamic
memory allocation). When an object is no longer referenced by any variable or data structure
in the program, it becomes eligible for garbage collection.
The Java Virtual Machine (JVM) is responsible for garbage collection, and it periodically
checks for objects that are no longer reachable and releases their memory. The JVM uses
different garbage collection algorithms to perform this task, and the choice of the algorithm
depends on the JVM implementation and configuration.
Mark: The garbage collector traverses the object graph starting from the root objects
(typically global variables, local variables in active method frames, and static variables) and
marks all the objects that are still reachable.
Sweep: The garbage collector goes through the entire heap and reclaims memory occupied by
objects that were not marked as reachable. These objects are considered garbage and are
freed.
Compact (optional): Some garbage collectors, like the generational garbage collector, may
perform additional steps, such as compacting the memory to reduce fragmentation.
The garbage collection process is automatic and transparent to the Java developer. Java
developers do not need to manually manage memory deallocation, unlike in languages like C
and C++. However, it's still essential to be mindful of object lifetimes and avoid unnecessary
object creation to improve performance.
The garbage collection process is an essential aspect of Java's memory management model,
allowing developers to focus on writing code without worrying about manual memory
management, leading to more reliable and secure software development.
Finalize Method
The finalize() method in Java is a method defined in the Object class. It allows an object to
perform some cleanup operations just before it is garbage collected by the JVM. The
finalize() method is called by the garbage collector when it determines that there are no more
references to the object, and the object is about to be removed from memory.
java
Copy code
protected void finalize() throws Throwable {
// Cleanup code here
}
The finalize() method has the following characteristics:
Access Modifier: The finalize() method is defined with the protected access modifier. This
means that only the object itself or a subclass can override and call the finalize() method
directly. It cannot be accessed from other classes.
Return Type: The finalize() method has a return type of void, meaning it does not return any
value.
Exception: The finalize() method declares throws Throwable. This allows it to throw any
exception, but it's generally not recommended to throw exceptions from the finalize()
method.
It's important to note that the finalize() method has been deprecated starting from Java 9, and
it is strongly discouraged to use it for resource cleanup or any critical operations. The reason
for deprecation is that the finalize() method has several drawbacks and is not reliable for
resource management.
Call by Value
In Java, when you pass primitive data types (like int, double, char, etc.) or references to
objects as arguments to a method, it uses a mechanism called "call by value." This means that
the value of the variable is passed to the method, rather than the actual variable itself.
Call by value means that changes made to the parameter inside the method do not affect the
original value of the variable in the calling code.
Example:
class Operation
{
int data=50;
void change(int data)
{
data=data+100;//changes will be in the local variable only
}
}
}
Recursion
Base case(s): These are the simplest instances of the problem that can be solved directly
without further recursion. Base cases are essential to prevent infinite recursion and ensure
that the recursion eventually terminates.
Recursive case(s): These are the cases where the function calls itself with a modified version
of the problem, bringing it closer to the base case. The function continues to call itself
recursively until it reaches the base case(s).
Output:
What is JDBC?
With JDBC, developers can create database connections, execute SQL queries, retrieve query
results, and manage database transactions within their Java applications. JDBC abstracts the
complexities of connecting to various database systems and provides a unified interface for
interacting with different databases, such as MySQL, Oracle, PostgreSQL, Microsoft SQL
Server, and more.
JDBC consists of classes and interfaces that define the methods and operations necessary for
database communication. It includes components like DriverManager (for managing database
connections), Connection (for representing a connection to the database), Statement (for
executing SQL queries), ResultSet (for holding query results), and PreparedStatement (for
executing parameterized queries efficiently), among others.
"Get text" and "set text" are terms commonly used in programming to refer to actions
involving data retrieval and data modification, respectively. These terms are often associated
with user interface elements, like text fields or labels, in software applications. Here's a brief
differentiation between the two:
Get Text:
"Get text" refers to retrieving the current content or value of a text-based user interface
element.
In the context of user interfaces, it means reading the text that is already present in a specific
component, such as a text field or label.
This action is used when you want to display or use the content of the element elsewhere in
the application, such as displaying it in a different part of the interface or processing it in
some way.
Set Text:
"Set text" refers to updating or changing the content or value of a text-based user interface
element.
In the context of user interfaces, it means modifying the text that is displayed in a specific
component, such as updating the text of a button, label, or text field.
This action is used when you want to change the visible content of the element based on user
interactions or other programmatic events.
In summary, "get text" is about retrieving the current content of a user interface element,
while "set text" is about updating or changing the content of the element. These actions are
fundamental when dealing with user input and display in software applications.
Let's provide an example that combines the use of forName, getConnection, and
prepareStatement functions in the context of JDBC (Java Database Connectivity). In this
example, we'll demonstrate how to connect to a MySQL database, execute a parameterized
SQL query using a prepared statement, and retrieve data from the database.
Example:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
try {
// Dynamically load the JDBC driver class
Class.forName(jdbcDriver);
// Close resources
resultSet.close();
preparedStatement.close();
connection.close();
} catch (ClassNotFoundException e) {
System.err.println("JDBC driver class not found: " + e.getMessage());
} catch (SQLException e) {
System.err.println("Database error: " + e.getMessage());
}
}
}
In this example:
Driver Manager
DriverManager is a class in Java that plays a crucial role in the Java Database Connectivity
(JDBC) API. It is used to manage a list of database drivers. When working with databases
using JDBC, the DriverManager class is responsible for:
Loading JDBC Drivers: The DriverManager class is used to load JDBC drivers dynamically.
JDBC drivers are required to establish a connection between a Java application and a specific
database system. The DriverManager class uses the forName method to load the appropriate
driver class based on the database URL provided.
Establishing Database Connections: Once the driver is loaded, the DriverManager helps in
establishing connections to the database. It provides methods like getConnection that take a
database URL, username, and password as parameters and return a Connection object
representing the connection to the database.
Managing Multiple Drivers: The DriverManager can handle multiple drivers simultaneously.
It maintains a list of registered drivers and attempts to find a suitable driver that can establish
a connection to the specified database URL.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
try {
// Dynamically load the MySQL JDBC driver class
Class.forName("com.mysql.cj.jdbc.Driver");
The DriverManager class simplifies the process of managing database connections and driver
loading in Java applications, making it an essential part of JDBC-based database interactions.
Net Beans
Multi-Language Support: While NetBeans has a strong focus on Java development, it also
supports other languages like JavaScript, HTML, CSS, PHP, and more. This makes it
suitable for a wide range of projects.
Integrated GUI Builder: NetBeans includes a powerful and user-friendly GUI builder that
allows developers to create graphical user interfaces visually. It simplifies the process of
designing and laying out components in Java Swing applications.
Code Editor and Code Generation: The IDE provides a feature-rich code editor with
syntax highlighting, code completion, and various productivity tools. It can generate
boilerplate code for common tasks, reducing manual coding effort.
Version Control: NetBeans supports version control systems such as Git, Subversion, and
Mercurial, enabling seamless collaboration and code management.
Maven and Ant Integration: It integrates with build systems like Apache Maven and
Apache Ant, making it easier to manage project dependencies and build processes.
Plugin Ecosystem: NetBeans has a rich ecosystem of plugins and extensions that enhance
its functionality. Developers can find and install plugins for various frameworks, libraries,
and tools.
Java EE and Web Development: NetBeans has extensive support for Java Enterprise
Edition (Java EE) development, making it suitable for creating web applications using
technologies like JavaServer Faces (JSF), Java Persistence API (JPA), and Enterprise
JavaBeans (EJB).
Mobile Development: NetBeans provides tools for developing mobile applications for
platforms like Android and Java ME (Micro Edition).
Community and Open Source: NetBeans is developed as an open-source project under the
Apache Software Foundation. This allows for community contributions and ensures
continuous improvement.
NetBeans has gained popularity for its user-friendly interface, strong support for Java
development, and the range of features it offers to streamline the software development
process. It's worth noting that the IDE landscape evolves, and developers often choose their
tools based on personal preferences and project requirements.
Wamp Server
WampServer is a software bundle that provides a platform for developing and testing
dynamic web applications locally on a Windows environment. The name "WampServer" is
derived from the combination of the software components it includes: Windows, Apache,
MySQL, and PHP. It simplifies the process of setting up a web development environment on
your local machine, allowing you to work on web projects before deploying them to a live
web server.
Apache: Apache is a widely used open-source web server software. In the context of
WampServer, Apache serves as the web server that handles incoming HTTP requests and
serves web pages to users' browsers.
2. Local Development: With WampServer, you can develop and test your web applications
locally before deploying them to a live web server. This is particularly useful for
debugging and troubleshooting.
3. Isolation: Since WampServer runs locally on your computer, you can work on your
projects without affecting any live websites or servers.
4. Offline Access: You can develop and test your applications even when you don't have an
active internet connection.
5. Integrated Tools: The inclusion of Apache, MySQL, PHP, and phpMyAdmin in a single
package simplifies the setup and management of your development environment.
However, it's important to note that while WampServer is convenient for local development,
it is not suitable for production use. For deploying applications to a live web server, you
would need to configure and secure a production environment with separate installations of
Apache, MySQL, and PHP.
Alternatives to WampServer include XAMPP (which is similar and also includes Perl) and
individual component installations (e.g., installing Apache, MySQL, and PHP separately).
Your choice of local development environment depends on your preferences and project
requirements.
To achieve this, you would typically use the Java Database Connectivity
(JDBC) API. Here's a basic example demonstrating how to insert and select
data from a database using Java and JDBC:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
try {
// Establish a database connection
Connection connection = DriverManager.getConnection(jdbcUrl, username,
password);
while (resultSet.next()) {
int employeeId = resultSet.getInt("employee_id");
String firstName = resultSet.getString("first_name");
String lastName = resultSet.getString("last_name");
System.out.println("Employee ID: " + employeeId);
System.out.println("Name: " + firstName + " " + lastName);
System.out.println();
}
resultSet.close();
preparedStatement.close();
}
}
In this example:
This example is a simplified illustration of inserting and selecting data using JDBC. In a real-
world scenario, you would handle exceptions, manage connections more efficiently (possibly
using connection pooling), and organize your code in a more structured manner.
Deletion:
Design UI:
o Populate the JTable with data from your data source (e.g., a database or an array).
o You can do this in the constructor or an initialization method of your JFrame.
Updating:
Design UI:
o Drag and drop a "Details" panel onto the JFrame to show editable fields for updating
data.
o Drag and drop an "Update" button onto the JFrame.
Software Requirements:
Operating System: Windows XP/Vista7/8 Operating System.
Front End tools : Notepad,NetBeans IDE 7.2.1,Notepad++
Backend : MySQL Server
Output: Window Application
Webserver : Wamp Server
Introduction To Project
“INVENTORY MANAGEMENT SYSTEM”
An inventory management system tracks inventory availability at all points of your supply
chain — from purchasing, to production, and finally sales to consumers. An inventory
management system is important for companies with large amounts of inventory in order to
keep it at optimal levels.
3. Quality Management:
The software has the ability to identify and track issues that can cause delayed
shipment or broken packages. Through the already feed data provides guidance to
quality management.
5. Improved Profitability:
The software helps to reach the maximum amount for business investment. It uses
marketing and production to increase profits. With the software's ability to
automatically operate the business in terms of management of inventory possibility of
fulfilling tasks efficiently and accurately, increases.
It can be in any terms from managing stocks to updating lists on all channels. Then
the processing orders will turn to reduce expenses and maximize profitability.
6. Planned Management:
You can identify the possibilities of opening multiple stock storehouses located near
the customers' location. This will increase efficiency and improve service levels.
8. Inventory Reports:
The software is meant to generate automated reports. You can get any report such as a
low stock report, inventory validation report, inventory forecast report.
9. Inventory Tracking:
Inventory tracking is the most beneficial function and feature of inventory
management software. The software keeps the track of unlimited serial numbers from
when the inventory is received until the time it is issued.
Public companies must track inventory as a requirement for compliance with Securities and
Exchange Commission (SEC) rules and the Sarbanes-Oxley (SOX) Act. Companies must
document their management processes to prove compliance.
The two main benefits of inventory management are that it ensures you’re able to fulfill
incoming or open orders and raises profits. Inventory management also:
Saves Money:
Understanding stock trends means you see how much of and where you have
something in stock so you’re better able to use the stock you have. This also allows
you to keep less stock at each location (store, warehouse), as you’re able to pull from
anywhere to fulfill orders — all of this decreases costs tied up in inventory and
decreases the amount of stock that goes unsold before it’s obsolete.
Improves Cash Flow:
With proper inventory management, you spend money on inventory that sells, so cash
is always moving through the business.
Satisfies Customers:
One element of developing loyal customers is ensuring they receive the items they
want without waiting.
Manufacturing
Inventory management systems for manufacturing have hybrid features for material-based
inventory and warehouse management. These features incorporate advanced unit conversion
capabilities to handle bulk material stock, incorporate lean manufacturing methodologies,
material requirements planning and bill of material invoicing.
Sales Order Fulfillment: Use a single dashboard to view sales orders, create packing
slips and automate email confirmations to customers.
Multiple Warehouse Fulfillment: Track and fulfill orders with inventory stored
across multiple warehouses.
Kitting: Control, transfer andconnect items normally tracked individually to a
bundled sales order for offerings like a subscription box.
Lot Tracking: Track multiple quantities of perishable, time-sensitive items by
manufacturer expiration date with traceable lot numbers.
Bin Management: Bin management allows for inventory to be received at the
warehouse and put-away into preferred bins within the rack system of the warehouse
for easy picking later during the order fulfillment process
Retail
Retailers depend on inventory management features that optimize the in-store customer
experience. They need solutions that improve inventory tracking, demand forecasting and
inventory alerts. Accurate, multi-location management features are essential for multi-
channel operations (e.g. buy online, pickup in-store). Point-of-sale and accounting integration
features are crucial for profitable brick-and-mortar retail operations. Read our guide on retail
inventory management for tips and best practices.
Top features for retail include:
TABLE NAME
DATABASE SCREENSHOTS
DATA BASE NAME : INVENTORY
TABLE :DATA
TABLE:INV
DATABASE ENTRIES SCREEN SHOTS:
PROJECT SCREENSHOTS
Step 1: Open Project
Step 2: Choose Destination
3.Dealer ID:
4.View:
5.Delete:
6.Search:
7.Logout:
FUTURE WORK OF
INVENTORY MANAGEMENT SYSTEM :
In many businesses, particularly service providers, stock is often also stored across a fleet of
vans. This can make it difficult to monitor stock levels, which in turn makes it problematic to
spot where excess stock has been ordered or where stock levels are running low. Too many
businesses are relying on manual processes that inevitably increase inventory errors and
inaccuracies. In a recent article, Finance Online confirmed ‘It’s alarming that many
businesses, particularly SMBs, are still not utilizing inventory management systems for
operations. Moreover, some don’t even have a way to track their inventory.’1
Inadequate inventory management results in delays and time wasted on jobs that cannot be
completed efficiently due to unaccounted for stock-outs. Stock-outs can result in high
emergency delivery or collection costs, just to enable a job to be completed, as well as an
increased risk of costly production downtime. Other inadequacies with inventory
management result in delays, inaccurate invoicing, and poor cash flow, which leads to
excessive spend or overconsumption of some materials. According to IHL Group, ‘the
estimated value of global inventory distortion among mass merchants and grocery retailers in
2020 is $176.7 billion for overstock and $568.7 billion for out-of-stock.’2
Spreadsheets, paper, and stand-alone systems can’t deliver the inventory accuracy and
supply-chain visibility it takes to stay competitive in the digital world.
App-based store and van stock management systems are becoming more popular as supply-
chain logistics become more complicated, and customers become increasingly demanding.
According to Easy Post, ‘Companies can reap a 25% increase in productivity, a 20% gain in
space usage, and a 30% improvement in stock use efficiency if they use integrated order
processing for their inventory system.’3 Advanced mobile applications allow companies to
manage their inventory and supply chains effectively. These systems efficiently record every
scan and every movement of inventory and are designed to prioritise inventory accuracy, cost
reduction, and charge capture through job number management. Businesses spend a
significant amount of money on financing and stocking their inventory and it’s important to
optimise this inventory to remain competitive. With extended lead times due to the pandemic,
companies are having to invest more capital in inventory to ensure supply to customers.
In a McKinsey survey of global supply-chain leaders, it was found that 61% of respondents
were either planning to increase or had already increased, the inventory of business-critical
products in order to boost ‘supply chain resilience’ as a result of the pandemic.’4 And research
from IHL found that inventory distortion costs in 2020, in the retail sector alone, cost retailers
‘collectively nearly $1.8 Trillion globally.’5 There are also ever-increasing expectations for
improving Key Performance Indicators (KPIs) for customer service. Therefore, achieving
inventory excellence, by optimising through app-based inventory management systems, is
becoming increasingly important to support the customer-service function, improve cash flow
and increase profitability.
Store and van stock management is being revolutionised with the use of inventory and
supply-chain management apps on mobile devices. However, not all app-based inventory
management systems are the same.
It is essential that the inventory management solution a business chooses has the
functionality required to enhance the operations of the business
The store is at the centre of all operational activity, responsible for stocking and distributing
supplies such as tools, equipment, personal protective equipment (PPE), and supplies to
employees, enabling them to fulfil their business requirements.
It is therefore essential that the inventory management solution a business chooses has the
functionality required to enhance the operations of the business.
BIBLIOGRAPHY
General
1. Oracle Java mother site @ https://www.oracle.com/technetwork/java/index.html.
2. OpenJDK mother site @ https://openjdk.java.net/.
3. Java Documentation @ https://docs.oracle.com/en/java/index.html.