Good programming practice for using static import fields?

I declare some constant variables in the class 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:

import com.mygame.ui.login.LoginInfoSQLiteOpenHelper.*;

Is this a good practice? Or is the traditional way of using constants better?

LoginInfoSQLiteOpen.USERNAME
+5
source share
3 answers

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 . , , , , .


, IDE, IDE (, ), VIM IDE, vim ( IDE).
, , IDE , , . , , , , .

+9

, . , , LoginInfoSQLiteOpen.USERNAME. , .

+2

All Articles