Notepad for new ideas

  • 5
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.
You can't complete this task, because you're not signed in.
  • Popular
  • New
  • Old
You must be signed in to leave a comment
andy 6473Level 7 , Bangalore
19 June, 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.
RyanLevel 11 , Ashburn
31 May, 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";
29 March, 01:32
Another copied and pasted answer. I think that this static-non-static-instance-dynamic-variables mess is impossible to understand for my brain. I think that I understand less and less java.
29 March, 01:28
Another solution copied and pasted. I think that it will be impossible for me to understand all this jargon about classes, static, non-static, instance, etc.
ZserboLevel 19 , Budapest
21 June 2019, 17:22
I don't get this exercise. How should the getDescription() method return a description if there is no input?
Justin SmithLevel 8
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.
Johnson JoseLevel 10 , Edinburgh
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?
ThomasLevel 9
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
Muhammad VahhaajLevel 19 , Rawalpindi
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