Apps Question about import

Bee Torika

Newbie
I have to import those three classes.


import android.graphics.Color;

import android.graphics.Paint;

import android.graphics.Canvas;


And I will simply import all of that by

import android.graphics;



So, I have a question.


Why a developers import each of them one by one ?

Why not just import like import android.graphics; ?


This way will take much more time and memory ?


Oh, I know this is basic question, but I want to know a reason..


Thanks.
 
D

Deleted User

Guest
Last edited by a moderator:
D

Deleted User

Guest
Well I think it's good to import specific classes, to avoid possibly the same class name in different packages.
 

HeavensSentSword

Well-Known Member
Doesn't it keep the whole project smaller to? If you are using only one method from a lib then why import the whole thing if you just want one method from a .somthingorother
 
D

Deleted User

Guest
It's probably more efficient to import specific classes, but in terms of class loading, then the JVM only imports what it needs at runtime. I don't think it actually makes a whole lot of difference tbh.
 
Top