Happy New Year in JAVA!!!

New Year new resolutions they say – Today marks the beginning of a new year, a chance to look at the world afresh and to step into that new day and new world boldly. It’s time to start something new, open a new diary, clear our thoughts, take up new challenges, refocus our energies, set new goals and conquer more territories. Happy New Year BCB Readers *Hugs and Kisses*

If programming is on your list of those new challenges you seek to conquer in the New Year, I strongly believe you should not wait one more day. There is no better time to start than now. That is why I will be welcoming you to the New Year with your first Java Application – HappyNewYearApp. It will simply display the greeting “Happy New Year!!!”

To create this program, you will do the three things below: 

  • Create a source file

A source file contains code, written in the Java programming language, that programmers can understand. You can use any text editor to create and edit source files or use an IDE . For help on how to set up the tools see previous post…

  • Compile the source file into a .class file

The Java programming language compiler (javac) takes your source file and translates its text into instructions that the Java virtual machine can understand. The instructions contained within this file are known as bytecodes.

  • Run the program

The Java application launcher tool (java) uses the Java virtual machine to run your application.

Building JAVA application using Text Editor

I believe you must have downloaded Notepad++ using the link provided in my last post. If YES then follow the steps below to create your first application.

STEP 1: Launch Notepad++, click on language, go to letter J on the drop down and click on java as shown below

notepad

STEP 2: Name the application by saving it in a location on your computer. In my case, I created a folder called My Java Lessons on my computer’s D drive and I saved the application as HappyNewYearApp

directory

On Notepad++

save_JavaApp

Step 3: Type in your source code in the screenshot below and remember to save your changes. I will be analysing every keyword in my next lessons.

HappyNewYearApp

Step 4: Launch Command Prompt, navigate to the location of the app on your computer.

Capture

folderNavigation

Step 5:   Compile the source code as shown below.

CompilingJava

Step 6: Run or execute the application

runningJava

Yaaay!!! You just created your first application. See the output on the screenshot above “Happy New Year!!!”

In Summary:

  • Create the program by typing it into a text editor and saving it to a file e.g. HappyNewYearApp.java.
  • Compile it by typing “javac HappyNewYearApp.java” in the terminal window.
  • Run / execute it by typing “java HappyNewYearApp” in the terminal window.

Practice: Following programming steps, create your Hello World application.

Note: You can forward your solution to my email gbonjubeeblog@gmail.com for review.

Wishing you a wonderful and “codeful” year!!!

 

Advertisements

One thought on “Happy New Year in JAVA!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s