Security in java? – Stack Overflow

Recently school has started torturing me with Java.
AND

java is SECURE

is always mentioned when talking about it’s features.

I can’t understand how can a programming language be “secure”.

Does writing code in java decrease the chances of the application made from it getting hacked or infected by a virus (if so then is it worth it sacrificing the speed for security cuz it’s just too slow compared to C++), or is it just the access specifiers used in a class (public, private and protected) that make it “secure”(by not allowing programmers to access some of the variables and methods).

Why is security mentioned as a feature of java? and if it is secure, is it worth sacrificing the performance for security as its really really slow compared to C++?