Windows Notepad is a very basic text editor that comes pre-installed on all Windows Operating Systems.
Notepad may be quite simple with no syntax highlighting or Intellisines like other tools like Notepad++, but that does not stop you from writing any kind of programming or scripting code in Notepad.
Let's take a look at how to write and run "Hello World" code in Notepad for 5 popular programming languages.
JavaScript:
<!DOCTYPE html>
<html>
<body>
<script>
document.write("Hello, World!");
</script>
</body>
</html>
Make sure to save the file with .html extension.
You can open this HTML file in a web browser (such as Microsoft Edge or Google Chrome) to see the output.
Python:
print("Hello, World!")
Save the above Python code with a ".py" extension (e.g., hello.py):
To run this code, open Command Prompt or Terminal on your Windows PC, navigate to the folder where the hello.py file is located, and then run:
Java:
public class HelloWorld {
public static void main(String... args) {
System.out.println("Hello, World!");
}
}
To run it, open Command Prompt, navigate to the folder containing HelloWorld.java, and compile and run it using these commands:
C++:
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
Make sure to save the file as hello.cpp
Ruby:
puts "Hello, World!"
Make sure to save the file as hello.rb, to run it, open Command Prompt and run:
Facing issues? Have Questions? Post them here! I am happy to answer!
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
- Fix Windows Update Error Code: 0x80070643
- How to Create Awesome Quizzes using Windows 365 Forms
- [Fix] Microsoft Windows Store error 0x00000005 (Windows 8/10/11)
- Windows 365: Restore Deleted Distribution Group using Admin Center (Active Directory)
- How to Change Encoding of File from ANSI to UTF-8 in Windows Notepad
- How to Change the Default Shell in Windows Terminal App
- How to Create a Website (Webpage) using HTML on Windows Notepad
- How to Find the Location of Notepad on Windows 11
- How to locate Python Installation on Windows (10/11)
- Top 5 Fonts for Windows Notepad
- Fix: Windows Update Error Code: 0x800f0922
- Office.com downloading zero byte file name prelanding on Safari browser
- How to Search in Notepad Application on Windows
- Cannot access Windows application shortcuts on Start menu and Taskbar
- How to add Solver Add-in in Microsoft Excel on Mac
- How to Freeze Top Row in Excel for Mac
- [Fix] Microsoft Windows OneDrive 0x8007018b Error Code
- Mac: Sign in Required We cant upload or download your changes because your cached credentials have expired [Word Excel]
- Grep Alternative for Windows CMD or PowerShell: findstr
- Fix: Failed in attempting to update the source: winget
- How to lock cells in Microsoft Excel for Mac
- Enable Cloud Based Clipboard for Images and Text on Windows 10/11
- How to update Microsoft Excel on Mac
- How to Make a Windows Notepad File Read-Only
- sudo is not recognized as an internal or external command
- Force Gradle to use specific Java JDK Version - Gradle
- Twitter is down? Issues with Tweet create events affecting APIs - Twitter
- How to do screen recording on Mac - MacOS
- Hyperlink in html (anchor tag) without a underline - Html
- Android : Remove ListView Separator/divider programmatically or using xml property - Android
- Steps to Install Jenkins on M1/M2 Mac - MacOS
- Fix [oh-my-zsh] Cant update: not a git repository - Git
- How to Configure GitHub with Eclipse IDE in 2023 - Eclipse