Last active
January 16, 2023 21:04
-
-
Save yubrajpokharel/737dc9e8db74b7ab43fc6abc03a5a736 to your computer and use it in GitHub Desktop.
Basic java Program structure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import statements (if any) | |
import java.util.Scanner; | |
// Class definition | |
public class Main { | |
// Main method | |
public static void main(String[] args) { | |
// Variable declaration and initialization | |
int number = 0; | |
// Object creation | |
Scanner input = new Scanner(System.in); | |
// Input | |
System.out.println("Enter a number: "); | |
number = input.nextInt(); | |
// Output | |
System.out.println("You entered: " + number); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment