I have one public static variable in one file and how can I export the same variable to other files?
For ex:-
file1.java
public final static int buf = 256;
file2.java
How can I access the variable "buf" in this file?
File1.buf
. More generally: ClassName.FIELD_NAME
. A few notes
CAPITAL_LETTERS
to name your static final fields (BUF
)static final
rather than final static
(not crucial, but it is a widely accepted style)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With