Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Let's code a mad libs game with Java! 📖
Play lesson

Java tutorial for beginners ☕ - Let's code a mad libs game with Java! 📖

5.0 (4)
40 learners

What you'll learn

This course includes

  • 12 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

#java #javatutorial #javacourse import java.util.Scanner; public class Main { public static void main(String[] args) { // MAD LIBS GAME Scanner scanner = new Scanner(System.in); String adjective1; String noun1; String adjective2; String verb1; String adjective3; System.out.print("Enter an adjective (description): "); adjective1 = scanner.nextLine(); System.out.print("Enter a noun (animal or person): "); noun1 = scanner.nextLine(); System.out.print("Enter an adjective (description): "); adjective2 = scanner.nextLine(); System.out.print("Enter a verb ending with -ing (action): "); verb1 = scanner.nextLine(); System.out.print("Enter an adjective (description): "); adjective3 = scanner.nextLine(); System.out.println("\nToday I went to a " + adjective1 + " zoo."); System.out.println("In an exhibit, I saw a " + noun1 + "."); System.out.println(noun1 + " was " + adjective2 + " and " + verb1 + "!"); System.out.println("I was " + adjective3 + "!"); scanner.close(); } }

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere