课程: Java for All Platforms: Desktop, Web, and Mobile Development

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Challenge: Secret word

Challenge: Secret word

(bright music) - [Lecturer] And now for this chapter's challenge. In this chapter we talked about Java FX and we made a simple Hello World app. The challenge is to create an app that has the user guess a secret word. So what we want to do is after pressing the button, display the word "Correct!" if the user entered the secret word "panda" in the text field. If the user enters anything else into the text field, show "Incorrect!". This challenge should take about 5 to 10 minutes to complete. If you'd like some hints, stick around. Here are some hints. You can use a constant or a variable to store the secret word, and then use an if statement to check if the input is equal to the secret word. And if so, we show "Correct!" And if not, we show "Incorrect!" Good luck.

内容