This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

access control

 
aruna ver
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
in the following code
package f1;
public class F1{}
package f2;
public class F2 extends F1{}

the ans given was
3) The code for F1 will compile but the code for F2 will not compile
why connot F2 see the class F1
i think F1 is public so it should be accessble even it is in differnt package
can any body help me out here
thanks
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think there should be an import statement!!!
::::
import f1.F1
 
Sarma Lolla
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i think there should be an import statement!!!
::::
import f1.F1

Please observe the missing semicolon at the end of import statement.
It should be import f1.F1;
 
Jasper Vader
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
picky, picky Sarma!
but the exam requires attention to detail like that!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic