Kate S.

asked • 11/14/14

How to I change a switch operation on a string to work in eclipse 1.6?

This is the code I have:
public static double monthly(String month) {
switch (month) {
case "01":
return .5;
case "07":
return .5;
return 1;
However, eclipse does't allow switch of a string in the 1.6 version. I'm having difficulty figuring out how to make it into a regular if-else or really anything else that could work in the earlier versions of eclipse.

1 Expert Answer


Evan H. answered • 11/14/14

4.8 (10)

Software Engineer specializing in Software Architecture and SRE

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.