Say i have two packages | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Say i have two packages

one named default package and the other named sample package. and default contains the class MyClass and sample package contains the class animal. now my question is do i need to import the animal class in order to use it in my class MyClass

11th Mar 2018, 7:35 PM
stephen haokip
stephen haokip - avatar
1 Answer
+ 3
Yes you'd need to import sample.Animal Note: default cannot be used as a user/programmer defined package name/identifier as it is already used by the Java language.
11th Mar 2018, 7:49 PM
ChaoticDawg
ChaoticDawg - avatar