Looking at Buffy's answer it's clear to me that I've understood the question quite differently, so I will set some context before I get to the point.
However you are good in only one language.
I think that this is too strong: it's possible to be good in several languages if you use them all frequently. However, I do know the feeling. The main language used in my undergrad course was Java, and that was virtually the only language I used in the 7.5 years after graduating. But for the past 9 years the primary language in most of the projects I've worked on has been C#. Now when I revisit Java I keep typing string
and getting compile-time errors until I correct it to String
.
On the other hand, the key word there is primary. One project was written in C# but used a code generation tool whose templates were in some weird Visual BASIC variant for which I never found documentation, and in addition had large and complex SQL stored procedures. Real world projects often contain an unholy mess of different languages, chosen for good or bad reasons, and the ability to handle that is a useful skill to develop.
As I know all languages are related to each other at some extent, but it's difficult for me to remember syntax for all languages
Supplement your memory. Write revision notes as though you were preparing for an exam on the differences between the language: one side of paper (A4 or letter) where you list the most important mappings from your strongest language to the target language. E.g. if your strongest language is Java then your notes for C# might include:
import
is using
- Method names begin with upper case
Map
is IDictionary
and HashMap
is Dictionary
- Generic types are reified, so if you have a static field
Foo
in a class Bar<T>
then Bar<string>.Foo
is a different field to Bar<int>.Foo
.
Also, use IDEs where possible. It's much quicker to fix compile-time errors as soon as you type them than to wait until you've finished a unit and can attempt to compile. Auto-completion for syntax is also getting quite advanced now.