Orphaned Case Error in Java

You ran into multiple problems here. Problem 1 : Look carefully your ; ends your switch there right away. Apparently all your case statements became orphans 🙂 Problem 2 : Your Switch should be switch(lower case s) Problem 3 : One more ; cause you compile time error at the line Note: I strongly suggest you to use an IDE, to save lot of time here. It … Read more

How to replace a substring of a string

You need to use return value of replaceAll() method. replaceAll() does not replace the characters in the current string, it returns a new string with replacement. String objects are immutable, their values cannot be changed after they are created. You may use replace() instead of replaceAll() if you don’t need regex. outputs

How to get today’s Date?

Since the methods are deprecated, you can do this with Calendar: And if you need a Date object in the end, simply call today.getTime()

How to override toString() properly in Java?

The toString is supposed to return a String. I suggest you make use of your IDE’s features to generate the toString method. Don’t hand-code it. For instance, Eclipse can do so if you simply right-click on the source code and select Source > Generate toString

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)