3 answers
Darrin’s Answer
I have written code in more than 10 languages and still don’t know java. Only because it wasn’t around when I first started. I guess my point is, if you can learn other languages then you could be fine.
Erik’s Answer
What a great question!
As a professional software developer, I have written code in several different languages: Pascal, C, perl, python, Scala, assembly, lisp and even Java. Of those, I only learned one in a classroom setting (Pascal) and I haven't written Pascal since the early 90s. So was learning Pascal a waste of time and effort? I don't think so since it was a vehicle for learning about the craft and science of programming. Things like how to manage software complexity, how to analyze algorithmic complexity, how to structure code for improved readability. All of those skills translate to any of the languages I listed ( with the exception of lisp I suppose).
Did I like Pascal? Not really. It was overly wordy and I didn't like the syntax for function argument passing and to this day I hate capitalized keywords in languages. But it started me down the path. Learning how to use Pascal made me understand what the language was good for and what it wasn't. I think the sign of a real craftsman is one who knows which tool to use for which job.
It's my opinion that Java will most likely fill the same role for you. Use it as a tool to learn the basics of computer science, use those basics to drive your studies forward. You will eventually find the language or environment that will evoke real passion and that will make all that Java worth-while.
Chirag R.’s Answer
Both answers from Erik and Darrin are very helpful.
I am not sure what your background is - are you enrolled in other comp sci courses; is this your first ever coding class etc?
Having said that, simplest advice I can give when taking up coding classes is to first write out your algorithm or steps for a program in simple english language on a paper ..usually called a DryRun ..or draw out simple flow charts as well and just focus on what your program does. Once you get that down, you can then start gradually trying to key that out using Java syntax and semantics. Practice first with few simple programs - like print a sequence of numbers, then sort them, etc..and progress to higher levels. You will see gaining command of the language quickly then.
DryRun example
=========
MyFunction()
If user clicks on "Like" button -- Call FunctionLike()
else If User clicks on "Mute" button -- CallFunctionMute()
Good Luck