2.
A First Simple Program
Now, it is time to create and run our very first Java program. This process
involves three key steps:
Write the program
Compile the program
Run the program
Write the Program
To write Java programs, you can use either a text/code editor or an IDE (Integrated
Development Environment). Both text/code editors and IDEs can be used to write code
in any programming language. However, they are different tools and are often used
for different purposes.
Text/Code Editor — A text or code editor is a lightweight tool designed primarily
for writing and editing source code. It is lightweight and fast, but it usually
lacks advanced features. It doesn’t come with built-in tools for compiling or
debugging, so you need to manually compile and run your Java program through the
command line or terminal. These editors are best suited for:
Writing small programs or practicing basic Java syntax
Making quick edits to code files
Developers who prefer minimalist and distraction-free interfaces
Learning environments where manual compilation is encouraged to understand the
process
Text or code editors are fast and lightweight, making them easier to learn for
beginners. They often provide helpful features such as syntax highlighting, bracket
matching, and support for extensions or plugins to enhance the coding experience.
Some popular text or code editors include:
Notepad — A very basic text editor included with Windows. It is suitable for
writing simple Java programs without any additional features.
Notepad++ — A lightweight and user-friendly editor that supports tabs, syntax
highlighting, and basic code formatting. Ideal for beginners who want a step above
Notepad.
Visual Studio Code (VS Code) — A powerful and customizable editor with support for
Java through extensions. It offers features like IntelliSense, debugging, Git
integration, and a rich plugin ecosystem.
Sublime Text — A fast and elegant code editor known for its smooth performance and
customizable interface. It supports multiple programming languages through packages
and extensions.
IDEs (Integrated Development Environments) — An IDE (Integrated Development
Environment) is a powerful software application that includes a code editor along
with built-in tools such as a compiler, debugger, project manager, and console
output. It also offers advanced features like code suggestions, auto-completion,
syntax highlighting, error checking, and integrated build and run capabilities —
all in one place. An IDE provides a complete development environment that helps
streamline the process of writing, testing, debugging, and managing code. They are
best for
Building, testing, and managing large-scale projects especially when productivity
and automation are important
Professional software development