Great ideas need to be written down or they can be forgotten very quickly. To help with this, in the Solution class, create a static Idea class. Give it a public String getDescription() method that returns any non-empty string. Then create a static public void printIdea(Idea idea) method that displays a description of the idea.
Notepad for new ideas
- 5
Locked
Comments (12)
- Popular
- New
- Old
You must be signed in to leave a comment
amj
29 August 2020, 04:51
wha is non empty string
0
Karas Java Developer
2 September 2020, 22:21
IN this case is just any string, a litle confusing, just return any string it can be "hello" or "Hello World!" any string will do the trick.
+3
Khongpak Phupkdee
25 March 2021, 03:52
Thank you
0
andy 6473
19 June 2020, 16:26
Static class with non static method. In this format to instantiate a Non-Static method , Static class object has to be created. That has been implemented in printIdea (new Idea()) where new keyword is used to create the constructor.
In the printIdea method we are passing Idea object has the argument using which we will be able to access getDescription() method of the static idea class. once Idea object has been created , we will be able to access Non Static getDescription method.
0
Ryan
31 May 2020, 23:03
A slight change in Requirement #3 would make task much easier to understand:
Current: 3. The getDescription method must return any non-empty string.
Proposed: 3. The getDescription method must return a string and it cannot be empty.
If you struggled with this as I did, you just need to literally return any String within the code. For example: return "description";
+7
Andrei
13 October 2020, 14:46
@Admins, yes to this proposal!
0
Roman
16 October 2020, 06:15
Thanks for the proposal, we'll consider it
0
Zserbo
21 June 2019, 17:22
I don't get this exercise. How should the getDescription() method return a description if there is no input?
+2
Justin Smith
10 November 2019, 22:21
I got hung up on that as well, the direction for "any non-empty string" is easy to misinterpret. You have the method return any string that isn't empty. So cat, yes, derp, 12345, literally anything as a string.
I thought it was saying create logic to determine whether an input was empty or not, and then return it if it isn't empty.
+6
Johnson Jose
17 May 2019, 06:58
The Idea class is a static class. What is the point of creating objects new Idea() ? I don't understand. How is this different from creating objects of a non-static class?
0
hidden #10362262
7 March 2019, 12:58
Can someone please explain what this exercise is asking? I don't understand what it is asking you to do, and also please help me to understand the concepts for this exercise. Thank you
+2
Muhammad Vahhaaj
15 June 2019, 07:58
it says to make one static class, one method of that class and one static method of Solution class
This exercise is intended to teach you the flow between static and non static classes. And that static methods and variable can only access static methods and variables
+1