TIL java is an amazing language, designed entirely upon the principle of "Do Not Repeat Yourself."

You're clearly trolling because you edited the referenced (poorly written) example to make it more redundant.

Calendar c = GregorianCalendar.getInstance();

You only cast it to a GregorianCalendar if you need something specific in the GregorianCalendar class, which is pretty much never. It's just a Calendar. The specific implementation is irrelevant as long as you use it as a calendar.

or:

Calendar c = new GregorianCalendar();

As for your question as to why Java is a strongly typed language, the answer is because Java is a strongly typed language. You don't like it, don't use it. I doubt you'll ever be in a situation where the constraints of the job (as in, a professional developer) have more influence than your own personal preferences.

BTW, you hate Java... why are you here? Oh yeah, trolling.

I'm not going to get into a circle jerk about typing strategies. I only replied because your bullshit question might confuse a person who is actually trying to understand something. You think it's better to type var than Person. Fine, you save three keystrokes. Except the IDE knows what I want before I do. So in the real world, new Person(); is about six keystrokes.

In fact... the following keystrokes:

Pers p =

Will typically get you Person p = new Person(); in any IDE I know of.

Cal c = Greg.getI will suffice in the first example.

I know, you're unconvinced. Java sux doodlol. Nobody really cares. It's a tool. You use it when it's the right time to use it. Stop trying to turn software development into some sort of idiotic apeman religious war. You reduce a language down to aesthetic preferences and you just truly miss the fucking point.

But you and your friends in the computer lab in the math and sciences building probably already have it all figured out. You've probably been programming for like 3 or 4 whole semesters.

/r/javaTIL Thread