Tagged Questions
7
votes
8answers
3k views
Why Java does not allow function definitions to be present outside of the class?
Unlike C++, in Java, we cannot have just function declarations in the class and definitions outside of the class. Why is it so?
Is it to emphasize that a single file in Java should contain only one ...
4
votes
2answers
246 views
Why are there no function pointers in Java? [closed]
Lately I started studying about different interesting concepts that exist in languages other than Java. Since the only language I've ever programmed with is Java, a lot of these concepts are very new ...
3
votes
8answers
449 views
Wrapping simple statement in a function in java?
I was working on neo4j graph database in java. To get the reference node of this db:
GraphDatabaseService graphDb=new EmbeddedGraphDatabase(DB_PATH);
Node Root=graphDb.getReferenceNode()
I ...
3
votes
2answers
257 views
Should I use chained functions in Java?
From time to time, I'll have a class in Java that takes a multitude of parameters, however, sometimes when I am creating an object of this class, I don't need to use all the parameters. As of now, I ...
0
votes
2answers
949 views
When to use functions vs methods?
So I know that methods are more OOP than functions.
I was wondering if someone could show me an example of a function and a method and explain the differences between methods and functions to me?
...