Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java weird method

Tags:

java

methods

I am currently trying to learn how to make games in 3D, so I watched a few YouTube-Tutorials. In one Tutorial I found this method:

int floorTexture = glGenTextures();
{
  // ...
}

Source (Line 215)

I have never seen this type of method (I think it's a method) before, so I now have two questions:

  1. Can I add parameters to this method? This code doesn't work

    int texture (String texturename) = glGenTextures();
    
  2. What does the =glGenTextures() do?

(I want to load different textures in one method.)

like image 515
user1363904 Avatar asked Feb 26 '26 23:02

user1363904


1 Answers

That's not a method declaration - it's a method call followed by a block.

The block itself is unnecessary, and basically just confusing. Heck, the fact that the main method is nearly 500 lines long is a good indication that this isn't code you should be taking hints from - at least in terms of structure...

like image 152
Jon Skeet Avatar answered Mar 01 '26 12:03

Jon Skeet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!