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.
@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 !
@juniorr_gomez6 жыл бұрын
Can you put a tutorial on this similar topic but using ArrayList
@lucasizquierdo76496 жыл бұрын
NGL you just made something so complicated seem so simple... Thank you :)
@renecabuhan16754 жыл бұрын
Yeah I notice that as wll
@bellalahyoussef40355 жыл бұрын
this guy is awesome ,he makes everything look so easy! thank you man you saved my ass
@AelroeZewdie Жыл бұрын
Thank you, no seriously thank you, I just finished my assignment because of this
@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
@k-universe00225 ай бұрын
great explanation 👏
@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.
@thelawgameplaywithcommenta26542 жыл бұрын
I added additional if statements to give different responses to varying scores.
@azudora82552 жыл бұрын
Thanks for the tutorial! This is more understandable than how my prof teaches
@gennilynpanizares1557 Жыл бұрын
This really helps me a lot thank you so muchhh
@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
@bittushah93116 жыл бұрын
Thank You! It is worth to have such video. It helped me a lot. Once again Thank You!.
@Samiullah-sk6er7 жыл бұрын
Thanks A lot For giving such code idea !
@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
@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!"); }
@daniellecruz33112 жыл бұрын
This is awesome. Thank you very much.
@goico62235 жыл бұрын
source code? your website does not display
@simpleguy79123 жыл бұрын
you find it or not
@kifter42545 жыл бұрын
Thank you man. You should do a java tuotorial for beginners. Would be amazing.
@marygracelabuan16166 жыл бұрын
You're great ,thanks sir.
@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?
@inspirationalquotes58404 жыл бұрын
Thank you. That was helpful
@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
@fengshili56244 жыл бұрын
Hi,I have some problem creating 20 questions quiz game.I can't define my variable.can you help me with that.thanks!
@jeffreywong35773 жыл бұрын
Thank you, Please keep up creating new videos
@user-ne6iy4xz1u5 жыл бұрын
thanks for teaching us
@abdeljalil18414 жыл бұрын
thank you so much Mike
@har91063 жыл бұрын
thank u , u saved my life
@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.
@theencryptedpartition4633 Жыл бұрын
Don't we need like setters and getters for these?
@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.
@sritamabanerjee13314 жыл бұрын
Hello Mike ..Can we do the same in blue j ?
@markdalogdog18644 жыл бұрын
How to random the questions and answer?
@biswajitsahoo14564 жыл бұрын
U are a god for me brother
@ericgoovaerts26033 жыл бұрын
how to print the two strings (prompt and answer) together? System.out.print( questions[x].prompt,answer) did not work ?
@johnvincentgenobaten64022 жыл бұрын
how to make this questions with scoring in try-catch exceptions?
@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?
@jughnnneeelll3 жыл бұрын
thanksss for thisss, but my problem is that how to use the try catch method using this?
@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 ?
@KJOB5 жыл бұрын
tough questions you made there
@xlsupermonkeylx66435 жыл бұрын
Is there a better way to do a questionnaire type thing that can accept user input and multiple-choice questions?
@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
@mageshwars51914 жыл бұрын
Ok....now how to make those list of questions appear in random order?....
@coreyoneill74225 жыл бұрын
Can you upload the Source code? Website is not showing it.
@rahulpradhan55856 жыл бұрын
great sir
@memoriser65334 жыл бұрын
thanks so much!
@albinsopaj4 жыл бұрын
What is the difference between a class type and a primitive data type? I don't see the difference?
@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
@peacekeepermoe6 жыл бұрын
I couldn't find the source code for this exercise... Got a link to it somewhere?
@jezzymallo43902 жыл бұрын
This helped
@moon_wei3 жыл бұрын
is this done on BlueJ ?
@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
@jorelletuyor4 жыл бұрын
Can you please tell me the codes to be used upon applying it to GUI
@fahrulrozi4094 жыл бұрын
can you tell me how to make the questions appear randomly please?
@aneesfathima58034 жыл бұрын
On which software is the code written ?
@jughnnneeelll3 жыл бұрын
can i also do this on java n-ide app?
@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).
@anonymouscat024 жыл бұрын
is there a way that i can get these questions randomly ordered?
@mrboyban3 жыл бұрын
just enter the random function
@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
@ashwinibagali76584 жыл бұрын
Which algorithm is used sir???
@muktarulhossain54255 жыл бұрын
Which IDE best for java project?
@SupreethM5 жыл бұрын
eclipse netbeans
@_GauriSanjayBarge2 жыл бұрын
where can i get the source code
@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.
@yomo27696 жыл бұрын
If i wanted to print a variable for a score how would i do that
@SupreethM5 жыл бұрын
score is the variable
@augh72874 жыл бұрын
The plus signs are the only signs that have error can someone help me fix this problem?
@simpleguy79123 жыл бұрын
where is the code please send the link
@jorelletuyor4 жыл бұрын
How can I apply this code into GUI?
@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) ^
@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....
@vanditasingh7773 жыл бұрын
where is source code?
@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
@banqueen90074 жыл бұрын
How can i do that in 2d array?
@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
@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 ??
@BennyAshurov2 жыл бұрын
i am stuck please help
@ahndreiybuscado59363 жыл бұрын
Why does he put another public class? What's the purpose of that?
@jrick30863 жыл бұрын
your codes is error
@anusha06246 жыл бұрын
How would I do this using JOption and Radio Buttons?? Anybody??
@jyotiprakash91866 жыл бұрын
nice
@itswanadiaries3 жыл бұрын
it doesnt work
@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")};
@kifter42545 жыл бұрын
How would I do this using math.random
@boss_aj5145 жыл бұрын
Same question here iwant the question to be in a random
@vanessamaebello20322 жыл бұрын
I tried it but sadly, many errors occur 😩💔
@joelsiennicki35904 жыл бұрын
recommend watching at 1.5 speed.
@shahzainhaider28014 жыл бұрын
Error in line public static void takeTest(Question[] questions){