CodingBowl

Java Mini Lesson 2: Saving Your Code with Git and GitHub

Published on 19 Apr 2026 Edu Mini Courses
image
Photo by Jon Moore on Unsplash

Real developers don't just "save" files—they use Git. Think of Git as a save history for your code that lets you undo mistakes at any time.

The 4 Commands You Need

You can manage your projects using these basic steps in the VS Code terminal:

  • git init: Start tracking a new project folder.
  • git add .: Tell Git which files you want to save.
  • git commit -m "message": Take a snapshot of your code with a short note.
  • git push: Upload your work to GitHub so it is backed up online.

Interactive Java Code (Using Scanner)

To make your programs interactive, you can use the Scanner class to read user input:


import java.util.Scanner;

public class AboutMe {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("What is your name? ");
String name = sc.nextLine();
System.out.println("Hello, " + name + "!");
}
}

Build Your Portfolio: GitHub is your developer portfolio. When you push your code there, you are building a collection of work that employers actually look at when hiring.

Meow! AI Assistance Note

This post was created with the assistance of Gemini AI and ChatGPT.
It is shared for informational purposes only and is not intended to mislead, cause harm, or misrepresent facts. While efforts have been made to ensure accuracy, readers are encouraged to verify information independently. Portions of the content may not be entirely original.

image
Photo by Yibo Wei on Unsplash