Last active
January 21, 2024 14:07
-
-
Save lol97/76adc01928a5583fcc35e73fb94a68a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.BigDecimal; | |
public class NoArgument { | |
interface Reference{ | |
public BigDecimal getGravitionalEnergyValue(); | |
} | |
public void doCalculateForce() { | |
Reference refInner= new Reference() { | |
public BigDecimal getGravitionalEnergyValue() { | |
BigDecimal grav = new BigDecimal(9.80f); | |
return grav; | |
} | |
}; | |
System.out.println("show gravitional value from inner = " + refInner.getGravitionalEnergyValue()); | |
} | |
public static void main(String[] args) { | |
Reference ref = | |
()-> { | |
BigDecimal grav = new BigDecimal(9.80f); | |
return grav; | |
}; | |
System.out.println("show gravitional value from main = " + ref.getGravitionalEnergyValue()); | |
NoArgument noArgument = new NoArgument(); | |
noArgument.doCalculateForce(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment