C# to Java

I saw this code on a video but it’s written on c# and i need to use it in a java code.
How can i convert this to java?

if (Physics.Raycast(player.position, (transform.position - player.position).normalized, out hit))

Simply remove the “out” modifier. It doesn’t exist in UnityScript (Unity’s JavaScript).

btw for your next question, post the error!!! The compiler usually tells you where the error is and usually gives a lot hints. Comments like “Well its not working” is totally useless.

I’m not 100% sure, but I think C# and JavaScript syntax is extremely similar in the function xxxx(){ } stuff, so I’m pretty sure it would just be the same.


It is the same you can check it out here.