• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

package does'nt exist compiler error

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created two packages namely "pA" and "pB" with class "pA" and "PB" defined in them respectively .
Now when i am trying to access public member of package "pA" it gives a compiler error addressing that package does not exist.

Any one kindly help me figure out the real flaw in this. Here is the code.




and in package b


Thanks in advance .
 
Marshal
Posts: 70654
288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your import is incorrect; it needs to be the fully-qualified name of a class.
 
Ranch Hand
Posts: 206
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, the import statement is incorrect as Ritchie stated.

Bad class and package naming convention which created confusion.

Try a full and meaningful naming:

For example,

package com.austin.pA;

class pA

or

package pA;
class pAClass

etc...


In this case class "pA" is default in package pA so, only classes in the same package can access it. You access class "pA" members you need a full qualified class name (i.e pA.pA or pA.pA.x) ) in this case.



 
Do Re Mi Fa So La Tiny Ad
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic