I declare some constant variables in the class SQLiteOpenHelper:
SQLiteOpenHelper
public static final String USERNAME = "user_name"; public static final String PASSWORD = "password";
In Activity, where I create SQL queries, I import these fields:
Activity
import com.mygame.ui.login.LoginInfoSQLiteOpenHelper.*;
Is this a good practice? Or is the traditional way of using constants better?
LoginInfoSQLiteOpen.USERNAME
If you look at the user code and see a field like
foo.do(baz, USERNAME);
wut (!), where did this var come from?search, grep, where is it declared?
ClassName.FIELD . , , , , .
ClassName.FIELD
, IDE, IDE (, ), VIM IDE, vim ( IDE)., , IDE , , . , , , , .
, . , , LoginInfoSQLiteOpen.USERNAME. , .
... , . , Java , , , . . , , , , .
: https://docs.oracle.com/javase/1.5.0/docs/guide/language/static-import.html