-2

I need to use two same named class in the same package.can i do it? like

package MyPackage;
class pkg{

}

class pkg{

}

Is it correct?

pushkin
  • 9,575
  • 15
  • 51
  • 95
Bipul Roy
  • 506
  • 2
  • 7
  • 18
  • Did you try it? If you did what was the result? – seenukarthi Aug 09 '15 at 04:12
  • 3
    Why do you want to do such a thing in the first place? Now when I ddefine a variable `pkg pkgVar;` which one will you give to me? If you can answer that question, then you can do it. – innoSPG Aug 09 '15 at 04:18

1 Answers1

2

You should learn to try these things yourself, or read the language specification.

The short answer is no, you can't do that.

markspace
  • 10,621
  • 3
  • 25
  • 39