So by building block you mean like
Public class questions
for all the questions and replies to the user
Public class altenatives
for the arraylists with alternatives
Public class quiz
for the code that does runs the program (system.out.println and such)
yes, you split the problem into smaller blocks. This changes the problem from one big thing, to a lot of very small blocks.
The blocks have a purpose too, so it gets more clear where to put what functionality. For example, you now decided that a reply to the user comes from "questions", and not eg from "alternatives". In other words, you're drawing lines in the sand where each part is. You can also draw lines between blocks, for example, "quiz" needs questions, so it uses the "questions" class.
Quite likely, your first lines are not optimal, but it's a start (and this won't get better, "programming" is to a large extent knowing how and where to draw these lines. While you get better at it with more experience, finding the optimal solution is always just out of reach ).
Therefore, if you find your lines are not good (this happens quite often), improve on them. This is easiest earlier in the process when you don't have much code. When you have code, and you change a building block, all code that uses the old building block has to be changed.
Inside the (.......) i should add the question right.
That was my intention indeed. However, you made a different set of blocks. If you use those, such things do change as well. Obviously you will still have a question, but it may end up at another spot in the program.
But would it be smart to make a public class with all of these and name them
Public class questions
QuizQuestion question_A = new QuizQuestion;
QuizQuestion question_B = new QuizQuestion;
The first question is always "does it work at all?". In other words, does the program actually do what it is supposed to do. Asking about "smart" implies you are confident things will work, and are looking for a way to do the same, but with less work or such that tomorrow you can add more building blocks without effort. I would suggest pick a (any) solution, and make it work first.
Having said that, no, it's not smart. You can use an arraylist of questions instead of storing every question in a separate variable (just like you have an arraylist of alternatives rather than each alternative in a separate variable). However, don't worry about it yet, once you have a working program, you can worry about improvements.
And then i add another class that stores the "print" code
This is possible, but not recommended in object oriented programming. A class is a unit of data and functionality, it's a smart building block. If you store a question in a class, you can add code to print itself, tell other blocks how many alternatives it has, or return whether "F" is the right answer to the question. A class is not just data, it can also have code associated with it.
Example
class Question {
private final String question;
public Question(String question) {
this.question = question;
}
public print() {
System.out.printf("%s?\n", question);
}
}
This class has a string named "question", that you can set from a parameter in the constructor. It also has a "print" method, that outputs the question to the console.
(Sorry about the printf, Java probably has a better way to print a string, but I am quite stuck in C/C++, and don't know such things.)
And what program do you use to run the code??? I have bern looking for days
A Java compiler, and a Java interpreter. The former is called javac, and the latter is called java (yep, same as the language).
I think however, you'll be much happier with an IDE that handles these things.
for example.