Create a multiple-choice test - Java Example

preview_player
Показать описание
The program creates a multiple-choice game. The question order and the choice order can be different for each play. It remembers the number of correct answers a user has got. Because the choice order can be varied, the correct answer option has to be varied accordingly.

You'll learn most by trying my code while watching the video.

Please post your improvement on my code on the comments.

Concepts:
Class and method
Array
ArrayList
indexOf method

Playlist of my Java course

Playlist of my Java examples
Рекомендации по теме
Комментарии
Автор

I am making a transition to Java domain from non-tech field. This channel is really helping me to understand the implementation of Java features . Thankyou!

ajaydalvi
Автор

This channel is really good for beginners and one can actually understand the source codes and all the happenings in the video. Thankyou so much. I was really able to understand and implement all the projects. Very helpful !!!

salonidhumal
Автор

Thank you for these small coding projects. I try to learn Java/OOP. components of Java make sense only when you put them into a real project.

mohamedelfadli
Автор

Thanks for the great video. could you please tell me how can I add this
- Feedback for every wrong answer
- Ask the user to try again
- Shuffle all questions and options and run the test again

scientist
Автор

Thanks for the tut! I have one question. Why private ArrayList<String> choices; is without word 'new'? What does it mean?

swistak
Автор

Thank you for the tutorial! ♥️
How do I limit the number of questions to display?
For example, I have made 20 questions but only 5 randomly selected are displayed.
And each time I restart the game, a randomly selected question set of 5 are selected... 😅

TheresNothingToSee
Автор

You would be the best man in the world if you could add some front end to present those questions. Not on console but web browser, jsf or js framework.. no matter

rocketleague
Автор

Im having a super hard time trying to run this program on Replit, how would I have the 3 files (question, Game, & Driver) to run on replit ??

oliverlopez
Автор

how can you both apply array and arraylist in choices? like mixed..its not working with me

xtinalq
Автор

The output result is come wrong if we choice all are correct the answer

inayatullahkhan
Автор

How would I add a message after each question saying if they got it right or not? If they got it wrong, how would I add a message saying "The correct answer should have been *answer*"?

ericdolland
Автор

do you have any graphic interface for this multiple choice quiz?

flavius
Автор

Are you using jdk to run this program or I can run it in cmd by saving it in notepad

Arun-ksvn
Автор

can you tell me how to do it with 2d arrays, which contain the question and the answer.Example: String [][] categoryJava ={ {"When was Java created?", "1995", "1989", "1501", "2005"}, {"When was Java created?", "1995", "1989", "1501", "2005"}, etc, etc}

staticbg
Автор

Sir, If i done 5 correct it give me output that you have done 4 correct and when i dont 3 it gives 2 mean -1 .why?

Khalil-Rex
Автор

how about i want read file, input question and answer from txt ?
like:
Question?
A) op1
B) op2
C) op3
D) op4
Ans: A
(Help me, plsss)

ThanhPham-vuoy
Автор

how would I verify an answer? like after a user inputs an answer, ask them "are you sure" or something.

owenleung
Автор

How can I put "a, , b., c." for the answer choices instead of "1:"?

jaespano
Автор

How do you add an option to reset/clear the game?

danellacortes
Автор

Game.java is giving me an error cannot find symbol class Question
why can it not access the class?

shahdkhaled