you are literally better at explaining code than my "professional" college prof. I feel like I should be paying you instead of him.
@SupreethM5 жыл бұрын
alternate code: public class mcq1 { public static void main(String[] args) { Scanner type = new Scanner(System.in); int score=0; String q1= "what color are apples? " +"(a)red (b)blue "; System.out.println(q1); String ans1=type.nextLine(); if(ans1.equals("a")){ score++; } String q2= "what color are bananas? " +"(a)red (b)yellow "; System.out.println(q2); String ans2=type.nextLine(); if(ans2.equals("b")){ score++; } System.out.println("you have scored:"+score+"/2"); } }
@bonzaii612 жыл бұрын
Appreciate this man
@enlightened73542 жыл бұрын
Procedure way of writing in your future projects will you, fuck. Up.
@ToastOfTheUndeadOFF2 жыл бұрын
appreciate this, gonna use this as a skeleton for my code
@VentusAstra Жыл бұрын
thank u so much!!
@AyshaFilms3 жыл бұрын
Just found this gem of a tutorial, thank you it simple to understand! Im new to coding, this taught me a lot
@ranjanadissanayaka53906 ай бұрын
this is very creative. And extremely well explained. Thanks so much Mike.
@juniorr_gomez6 жыл бұрын
Can you put a tutorial on this similar topic but using ArrayList
@peacekeepermoe6 жыл бұрын
Thanks for this video I managed to get most of my assignment done by following this :D
@Maen9634 жыл бұрын
Well copying assignments doesn't make a good programmer !
@Sofiacchi6 жыл бұрын
Hi! I tried doing this, but i created an array for the questions and another one for the answers. At 12:13 I put it inside a for loop so i could do "new Questions(questionsarray[i], answersarray[i])" but then i can't do the "takeTest(questions)" part cause it doesn't recognize the questions variable. I tried inicializing it in other ways but there's always an error. How should i do it, any advice? Thanks
@lucasizquierdo76496 жыл бұрын
NGL you just made something so complicated seem so simple... Thank you :)
@renecabuhan16754 жыл бұрын
Yeah I notice that as wll
@AelroeZewdie Жыл бұрын
Thank you, no seriously thank you, I just finished my assignment because of this
@bellalahyoussef40355 жыл бұрын
this guy is awesome ,he makes everything look so easy! thank you man you saved my ass
@JudePhilips4 жыл бұрын
On the off chance you see this because this comment is almost 4 years late, I would like to let you know your series of c++ and java are fantastic.
@falgunijaitly17822 жыл бұрын
Hi Mike! You are doing absolutely amazing. Please keep up. I am going through all your tutorials however for this one I have a question. Would this be an example of abstraction or encapsulation? Under which OOPs principle this falls under? And how?
@hadr1an9142 жыл бұрын
Thanks for this tutorial, it greatly helped my output test!
@utjitaanitamunamava22814 жыл бұрын
I like the way you teach Java thank you very much you came to rescue me
@goico62235 жыл бұрын
source code? your website does not display
@simpleguy79123 жыл бұрын
you find it or not
@fengshili56244 жыл бұрын
Hi,I have some problem creating 20 questions quiz game.I can't define my variable.can you help me with that.thanks!
@alidabot60226 жыл бұрын
Hi! Can you please put out a tutorial on the same topic but in JFrames with designing
@raomuhammadusama92444 жыл бұрын
I'm Building a Quiz Management System using JFrame Form in netbeans if you're interested I'll let you see
@hyungminkim66644 жыл бұрын
Gaming Hype yes please
@raahimanil17194 жыл бұрын
@@raomuhammadusama9244 pls share the System
@thelawgameplaywithcommenta26542 жыл бұрын
I added additional if statements to give different responses to varying scores.
@asniceful4 жыл бұрын
Hi Mike, Great work with your Java tutorials. I was just wondering why you chose double quote for the answer a ("a") instead of single quotes ('a') since 'a' is a character.
@williamselinder91383 жыл бұрын
Im no pro here, and you probably know why already, but I think its because its a string and not a character.
@wasifshahzad50013 жыл бұрын
ya me too, by using character we could've even saved up memory
@azudora82552 жыл бұрын
Thanks for the tutorial! This is more understandable than how my prof teaches
@k-universe00224 ай бұрын
great explanation 👏
@gennilynpanizares1557 Жыл бұрын
This really helps me a lot thank you so muchhh
@bittushah93116 жыл бұрын
Thank You! It is worth to have such video. It helped me a lot. Once again Thank You!.
@kifter42545 жыл бұрын
Thank you man. You should do a java tuotorial for beginners. Would be amazing.
@scottisitt4 жыл бұрын
I added messages to the score checker: if(answer.equals(questions[i].answer)) { System.out.println("Nice!"); score++; }else { System.out.println("Nope!"); } Also added different messages depending on your score. if(score == questions.length) { System.out.println("You got " + score + " out of " + questions.length + "! Nice job!"); }else if(score < questions.length && score > 0) { System.out.println("You got " + score + " out of " + questions.length + "! Not bad."); } else { System.out.println("You got " + score + " out of " + questions.length + "! That's a crap score!"); }
@Samiullah-sk6er7 жыл бұрын
Thanks A lot For giving such code idea !
@daniellecruz33112 жыл бұрын
This is awesome. Thank you very much.
@geriatricmillenial19836 жыл бұрын
hey great video just wanted to ask what the reason to create another class. Can I just have one class for this program?
@rezstrike5 жыл бұрын
did u find the answer to ur question ?
@SupreethM5 жыл бұрын
yes, you may have one class itself(personally consider it better), you do not have to create another. he might have created another class just for better understanding and to show how classes are used.
@marygracelabuan16166 жыл бұрын
You're great ,thanks sir.
@jeffreywong35773 жыл бұрын
Thank you, Please keep up creating new videos
@xlsupermonkeylx66435 жыл бұрын
Is there a better way to do a questionnaire type thing that can accept user input and multiple-choice questions?
@inspirationalquotes58404 жыл бұрын
Thank you. That was helpful
@stefanopenrhyn65016 жыл бұрын
Hi thanks for the video! It is very useful seeing the colours so you can easily identify the connections among the objects. Are you using a specific version of Java ?
@c123ian6 жыл бұрын
he is using Eclipse, a program you use to write Java www.eclipse.org
@SupreethM5 жыл бұрын
you can change the colors in your own ide
@sritamabanerjee13314 жыл бұрын
Hello Mike ..Can we do the same in blue j ?
@ufotofu96 жыл бұрын
When you create an instance of the Question class, you made it an array. I wasn't aware that you could do that. Could you explain a bit more about creating class objects and using them as "data types"? I find it confusing.
@eagerassaultixopi45585 жыл бұрын
same, have you figured it our yet ?
@shantb3642 жыл бұрын
Questions: lets say for question 1 the answer was “a”, will it give a wrong answer if the user entered “A”? Because I’m not sure if case-insensitivity was coded.
@DriveBreakFixRepeat2 жыл бұрын
Yes it will. Inside for the for loop when you accept the answer, do this: "String answer = scanner.nextLine().toUpperCase();" // or ".toLowerCase()" depending on how you write the code.
@peacekeepermoe6 жыл бұрын
I couldn't find the source code for this exercise... Got a link to it somewhere?
@abdeljalil18414 жыл бұрын
thank you so much Mike
@itbrezel3 жыл бұрын
Hey Thank you very much for this amazing Video! I have one question: why do we have given the Question the attribute prompt? What kind of purpose does it have?
@coreyoneill74225 жыл бұрын
Can you upload the Source code? Website is not showing it.
@user-ne6iy4xz1u5 жыл бұрын
thanks for teaching us
@jughnnneeelll3 жыл бұрын
thanksss for thisss, but my problem is that how to use the try catch method using this?
@ericgoovaerts26033 жыл бұрын
how to print the two strings (prompt and answer) together? System.out.print( questions[x].prompt,answer) did not work ?
@har91063 жыл бұрын
thank u , u saved my life
@markdalogdog18644 жыл бұрын
How to random the questions and answer?
@theencryptedpartition4633 Жыл бұрын
Don't we need like setters and getters for these?
@Leprolifique5 жыл бұрын
please help? How can i use if/else statement to allow user to run program multiple times, otherwise pressing any other key to exit?
@ZombieNicolas5 жыл бұрын
I think you what you need is a do{ "your program" }while(statment for leaving the program);
@SupreethM5 жыл бұрын
use a loop rather
@KJOB5 жыл бұрын
tough questions you made there
@moon_wei3 жыл бұрын
is this done on BlueJ ?
@johnvincentgenobaten64022 жыл бұрын
how to make this questions with scoring in try-catch exceptions?
@anonymouscat024 жыл бұрын
is there a way that i can get these questions randomly ordered?
@mrboyban3 жыл бұрын
just enter the random function
@jorelletuyor4 жыл бұрын
Can you please tell me the codes to be used upon applying it to GUI
@aneesfathima58034 жыл бұрын
On which software is the code written ?
@biswajitsahoo14564 жыл бұрын
U are a god for me brother
@mageshwars51914 жыл бұрын
Ok....now how to make those list of questions appear in random order?....
@memoriser65334 жыл бұрын
thanks so much!
@fahrulrozi4094 жыл бұрын
can you tell me how to make the questions appear randomly please?
@jughnnneeelll3 жыл бұрын
can i also do this on java n-ide app?
@albinsopaj4 жыл бұрын
What is the difference between a class type and a primitive data type? I don't see the difference?
@rahulpradhan55856 жыл бұрын
great sir
@_GauriSanjayBarge2 жыл бұрын
where can i get the source code
@yomo27696 жыл бұрын
If i wanted to print a variable for a score how would i do that
@SupreethM5 жыл бұрын
score is the variable
@veneraantiquar72144 жыл бұрын
Hi, can you please make a tutorial on the same topic but instead of for loop could you please do it in a try-catch block?
@breadnobones4 жыл бұрын
yo sameeeeeeed
@jorelletuyor4 жыл бұрын
How can I apply this code into GUI?
@jezzymallo43902 жыл бұрын
This helped
@muktarulhossain54255 жыл бұрын
Which IDE best for java project?
@SupreethM5 жыл бұрын
eclipse netbeans
@kifter42545 жыл бұрын
How would you do this, if the questions are picking randomly because you I have to use math. random to make the computer pick out a random 10 questions from a total 20. How Would i make them check if the answer is right then? Because question 1 isnt the same question all the time
@thanapongangkha14175 жыл бұрын
You would have to create 20 question objects. Since every object has their own prompt and answer , you just simply use Random class (google it, it's not hard to use) to random number in the range of 20 using nextInt() method and put it in the loop(so it will random new number everytime we pass the loop), in for loop you would use a random number as an index of the question array then do exactly like Mike did. And if you want the user to answer 10 questions, just tell for loop to loop 10 times. Hope this helps.
@simpleguy79123 жыл бұрын
where is the code please send the link
@bomjex6 жыл бұрын
thanks for your tutorial. I have a question: How do I put and else statement so, if the answer is wrong the system says: try again. Because the method is void and don't allow to introduce a return statement. I removed the void from the method and wrote the else return but doesnt work. Can you help please
@thanapongangkha14175 жыл бұрын
Have you got the answer yet? If not, you don't have to return anything. You can just use System.out.println("try again"); to display the message. Only return something when you want to store it to use later.
@SupreethM5 жыл бұрын
use System.out.println("try again"); under else
@SupreethM5 жыл бұрын
use a while statement for it to loop back to make the user try again, but then it will loop until the user gets it correct
@hollownights64694 жыл бұрын
How do I get the percentage?
@landylandinha384 жыл бұрын
Hi Mike, how can I display true and false
@twosongs73963 жыл бұрын
This feature would have to be part of your conditional. Example: if answer = questions[i.answer] println “String True!” Else println “String False, try again” or “String False, better luck next time” or stg like that....
@banqueen90074 жыл бұрын
How can i do that in 2d array?
@Karslo Жыл бұрын
Does anybody know why if we use "==" instead of equals it doesn't work? It works with other strings, but for some reason (even though they print the same character) answer is not == questions[i].answer
@franzkarlomartinez34935 жыл бұрын
How to repeat or retake the quiz?
@Gracovitz5 жыл бұрын
THere may be a "clear" button/option in the program that you are using for the project, if not, you can try and code a method that will reset the test once you've done it (maybe add a counter for the number of times you've done it).
@nikolasgestrich95983 жыл бұрын
what would I do if I have multiple correct answers for 1 question
@twosongs73963 жыл бұрын
Add an extra choice letter, say like “d) all of the above” or “d) b and c are correct” - simplest answer possible
@vanditasingh7773 жыл бұрын
where is source code?
@augh72874 жыл бұрын
The plus signs are the only signs that have error can someone help me fix this problem?
@bryanochoa24645 жыл бұрын
what if i input other letter/number in the answer. i mean how can i repeat the question if i did that? sorry for my english..
@thanapongangkha14175 жыл бұрын
Hi. You can do that by using while loop (eg. While(true) ) and set the condition like this. if (!keyboardInput.equals("a") || !keyboardInput.equals("b") || !keyboardInput.equals("c")) ). Remember that !a.equals(b) means "a is NOT equal to b" and || means "or". The code above is to check if the input is equal to a, b, c or not. If not, keep getting the input till the user input one of them. In the else statement put "break;" to exit the loop when the user input one of them.
@SupreethM5 жыл бұрын
for such cases learn about "try and catch" it will make your code much better
@MMMMEEKK5 жыл бұрын
This is OOP ??
@matrimanuel_7914 жыл бұрын
I didn't understend very well the part of code of the parameters of takeTest. takeTest(questions); ^ public static void takeTest (Question [] questions) ^
@anusha06246 жыл бұрын
How would I do this using JOption and Radio Buttons?? Anybody??
@ashwinibagali76584 жыл бұрын
Which algorithm is used sir???
@jyotiprakash91866 жыл бұрын
nice
@ahndreiybuscado59363 жыл бұрын
Why does he put another public class? What's the purpose of that?
@jrick30863 жыл бұрын
your codes is error
@BennyAshurov2 жыл бұрын
i am stuck please help
@kifter42545 жыл бұрын
How would I do this using math.random
@boss_aj5145 жыл бұрын
Same question here iwant the question to be in a random
@joelsiennicki35904 жыл бұрын
recommend watching at 1.5 speed.
@boss_aj5145 жыл бұрын
Can you make a vid for making a random question ?
@itswanadiaries3 жыл бұрын
it doesnt work
@kshitiz43366 жыл бұрын
Java
@pranavacharya67285 жыл бұрын
error: non-static variable this cannot be referenced from a static context Question q[]={new Question(q1,"a"),new Question(q2,"b")}; ^ error: non-static variable this cannot be referenced from a static context Question q[]={new Question(q1,"a"),new Question(q2,"b")};
@ScienceLifeChronicles25 күн бұрын
2024 still here
@shahzainhaider28014 жыл бұрын
Error in line public static void takeTest(Question[] questions){