-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
  • 8,468
  • 14
  • 46
  • 86
Bipul Roy
  • 426
  • 1
  • 7
  • 17
  • Did you try it? If you did what was the result? – Karthikeyan 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
  • 9,890
  • 2
  • 22
  • 37