“Hands On with Java”

Hello guys! This is our first article on Java. As this is our first article on java we will be dealing with the basics and some keywords used in java. So, let us begin guys. Are you excited to begin this journey with me? Lets go!

About Java

Java is a popular programming language, created in 1995. It is owned by Oracle, and more than 3 billion devices run Java.

It is used for:

  • Mobile applications (specially Android apps)
  • Desktop applications
  • Web applications
  • Web servers and application servers
  • Games
  • Database connection
  • And much, much more!

Why Use Java?

  • Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.)
  • It is one of the most popular programming languages in the world
  • It has a large demand in the current job market
  • It is easy to learn and simple to use
  • It is open-source and free
  • It is secure, fast and powerful
  • It has huge community support (tens of millions of developers)
  • Java is an object oriented language which gives a clear structure to programs and allows code to be reused, lowering development costs
  • As Java is close to C++ and C#, it makes it easy for programmers to switch to Java or vice versa

Java Install

Some PCs might have Java already installed.

To check if you have Java installed on a Windows PC, search in the start bar for Java or type the following in Command Prompt (cmd.exe):

If Java is installed, you will see something like this (depending on version):

If you do not have Java installed on your computer, you can download it for free at oracle.com.

In this tutorial, we will write Java code in a text editor. However, it is possible to write Java in an Integrated Development Environment, such as IntelliJ IDEA, Netbeans or Eclipse, which are particularly useful when managing larger collections of Java files.

Java Install

In Java, every application begins with a class name, and that class must match the filename. Let’s create our first Java file, called Main.java, which can be done in any text editor (like Notepad). The file should contain a “Hello World” message, which is written with the following code:

Main.java

Save the code in Notepad as “Main.java”. Open Command Prompt (cmd.exe), navigate to the directory where you saved your file, and type “javac Main.java”:

This will compile your code. If there are no errors in the code, the command prompt will take you to the next line. Now, type “java Main” to run the file:

The output should read:

Congratulations! You have written and executed your first Java program.

Blogroll


Social, Cultural u0026amp; Behavioral Issues in PHC u0026amp; Global Health
Social, Cultural u0026amp; Behavioral Issues in PHC u0026amp; Global Health
Social, Cultural and Behavioral Foundations of Primary Health Care (JHSPH)

Penny Zeller
Penny Zeller
Random thoughts from a day in the life of a wife, mom, and author


Discover more from Sophia's Tech Journey

Subscribe to get the latest posts sent to your email.

Leave a Reply

Discover more from Sophia's Tech Journey

Subscribe now to keep reading and get access to the full archive.

Continue reading