Yes, design a class for a purpose. However, that purpose may have many functions (and uses). One of the key elements of Java is to not re-design something when it works great, especially if all...
Type: Posts; User: helloworld922
Yes, design a class for a purpose. However, that purpose may have many functions (and uses). One of the key elements of Java is to not re-design something when it works great, especially if all...
...
Copy paste, and change the class name. Like I said, not very useful.
public class ReverseString1
{
String txt;
public ReverseString(String str)
{
Oh, it's definately possible. The question is why would you want to do that? In essence, you're creating two different identical classes :)) Not too many uses I can think of for that.
??? That makes no sense. If you want to reverse a string, you don't need two classes to do it. Simply have your first class reverse itself:
public class ReverseString
{
String txt;
...