Java Variables: Mad Libs (PLEASE HELP!)

Okay so I’m trying to teach myself Java, among other things, so I can try to get a job in computer tech or something similar but now I’m stuck on Mad Libs. I got to task 11 which wants you to use System.out.println() to print the story variable and I can not figure out how to run the code so the whole story prints with all the Strings I added. Can someone please help me out here? I would appreciate it a lot! I’m basically stuck until I can get help to figure this out.

public class MadLibs {
This program generates a mad libbed story.
Author: Chris
Date: 3/29/2021
public static void main(String args){
String name1 = “Chris”;
String adjective1 = “Great”;
String adjective2 = “Beautiful”;
String adjective3 = “Happy”;
String verb1 = “Dance”;
String noun1 = “People”;
String noun2 = “Food”;
String noun3 = “Music”;
String noun4 = “Kids”;
String noun5 = “Peas”;
String noun6 = “Democrats”;
String name2 = “Ashley”;
int number = 50;
String place1 = “Youngstown”;

  //The template for the story
  String story = "This morning"+name1+" woke up feeling "+adjective1+". 'It is going to be a "+adjective2+" day!' Outside, a bunch of "+noun1+"s were protesting to keep "+noun2+" in stores. They began to "+verb1+" to the rhythm of the "+noun3+", which made all the "+noun4+"s very "+adjective3+". Concerned, "+name1+" texted "+name2+", who flew "+name1+" to "+place1+" and dropped "+name1+" in a puddle of frozen "+noun5+". "+name1+" woke up in the year "+number+", in a world where "+noun6+"s ruled the world.";


I think I have it right so far? Just cant get the whole story to print. Very frustrating. I wish this site had video’s to help people like me who are completely new to this and need some help.

Hi there, welcome to the forums!

You’re almost there, you just need to add the System.out.println() inside of the main() method to get it to print out. Just add System.out.println(story); directly after the creation of the story string and that should do the trick.

Hey that worked thank you so much! I didn’t have it in the right place. I really appreciate the help, thanks again!