File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Inline function in JAVA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Inline function in JAVA" Watch "Inline function in JAVA" New topic
Author

Inline function in JAVA

Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1268

Hi .... Is there any option in java from where I can use the funcionality like of inline function as I used in c++?


No Kaustubh No Fun, Know Kaustubh Know Fun..
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13864
    
  10

In Java, there is no way to specify that you want a method to be inlined.

However, the JVM does inlining automatically for you. If you have for example a JavaBean class with simple getters, like this:

then the JVM will be smart enough to inline those getter methods at the places you call them. So calling those getter methods will be just as efficient as accessing the member variables directly.

In other words, normally you don't have to worry about inlining yourself in Java.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inline function in JAVA
 
Similar Threads
jQuery newbie doubts
Ever Need Hand Optimized Byte Code?
JSP + javasscript
final modifier
How do I include a java method in a section of jsp code