E and PI are not functions, they're static fields (data members). That code will output their values correctly. You don't have to import anything, the Math class is in the java.lang package, which is imported by default. (It's the only package imported by default, I believe.)
java - Should I import a math library, and if so how? - Stack Overflow
In Java, you cannot import single methods from a class, so how would I do it in my language?
How do I use/import the Apache Commons Math Java library?
How come I didn't need to import java.lang.Math for my code?
java.lang is always imported by default for Java.
More on reddit.comVideos
E and PI are not functions, they're static fields (data members). That code will output their values correctly. You don't have to import anything, the Math class is in the java.lang package, which is imported by default. (It's the only package imported by default, I believe.)
You don't have to import anything here. The java.lang.Math class should already be available as java.lang package is imported by default
Hey y'all, I'm writing a transpiled language, which, you guessed it, transpiles to Java.
Now, I was planning on doing a import statement like this:
incorp standard {
print_line,
read_line,
STD_SUCCESS,
STD_FAILURE}
which would transpile to something like this:
import libraries.standard; import libraries.standard.STD_FAILURE; import libraries.standard.print_line; import libraries.standard.read_line;
Problem is, I found out that you can't actually import a single method from a class in Java, so how would I go about fixing the problem? One solution I thought about would be that when importing a single function, it actually transpiles the single function to the Java code, while when importing the full library it imports the library as a object.