Skip to content

Learn & Explore

Learn practical technology, programming, IT infrastructure, cybersecurity and real-world experiences.

  • Home
  • Learn
    • IT Fundamentals
      • What Is Information Technology?
      • History and Evolution of Computer Technology
      • Components of an Information Technology System
    • Java
      • Introduction to Java: What It Is & Why Learn It
    • Programming
    • Web Development
    • Networking
    • Cyber Security
    • Database
    • Roadmaps
      • Java Roadmap
  • Resources
    • Technology Pioneers
      • Charles Babbage
      • Ada Lovelace
      • Alan Turing
      • Grace Hopper
      • Tim Berners-Lee
      • Dennis Ritchie
      • Linus Torvalds
    • IT Degrees in Nepal
      • BSc CSIT(TU)
    • Universities
      • Tribhuvan University
      • Kathmandu University
      • Pokhara University
      • Purbanchal University
      • Mid-West University
      • Far Western University
      • Nepal Open University
    • Quotes
  • About
    • Contact
    • Privacy Policy
    • Terms and Conditions
  • Home
  • Programming
  • My First Code in Java

My First Code in Java

Posted on November 12, 2022December 29, 2022 By macharaja No Comments on My First Code in Java
Java, Programming

Here is a simple “Hello, World!” program in Java:

public class MyFirstCode{
/* This is my first java program.
 * This will print 'Hello World' as the output
*/
public static void main(String args[]){
System.out.println("Hello World!");
 }
}

To run this program, we need to have the Java Development Kit (JDK) installed on our computer.

  1. Open a text editor and copy the code above into a new file.
  2. Save the file with a .java extension, for example MyFirstCode.java.
  3. Open a terminal or command prompt and navigate to the directory where you saved the file.
  4. Compile the Java program by typing javac MyFirstCode.java. This will create a new file called MyFirstCode.class.
  5. Run the program by typing java MyFirstCode.

You should see the text “Hello, World!” printed to the console.

Post navigation

Next Post: Quotes from Albert Einstein ❯

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • IT Career Guide for College Students in Nepal: A Complete Roadmap to Success
  • Procedural Programming vs Object-Oriented Programming (POP vs OOP)
  • What is Programming? A Beginner’s Complete Guide
  • Introduction to Object-Oriented Programming (OOP): Concepts, Features, and Benefits
  • Difference Between C and C++

Categories

  • C & C++
  • C#
  • Course
  • CSS
  • Cyber Security
  • Database
  • HTML
  • IT Career
  • IT Degrees
  • IT Degrees in Nepal
  • IT Fundamentals
  • Java
  • JavaScript
  • Microsoft SQL Server
  • My Learnings
  • MySQL
  • Oracle
  • PHP
  • Programming
  • Quotes
  • Technology
  • Technology Pioneers
  • Universities
  • Web Development
  • Web Hosting

Copyright ©2026