# Bug in trying reference type

**URL:** <https://forum.codewithmosh.com/t/bug-in-trying-reference-type/11866>\
**Category:** Java\
**Created:** [April 12, 2022, 10:34am UTC](https://forum.codewithmosh.com/t/bug-in-trying-reference-type/11866 "2022-04-12T10:34:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![barryberry24](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@barryberry24](https://forum.codewithmosh.com/u/barryberry24)\
**Post date:** [April 12, 2022, 10:34am UTC](https://forum.codewithmosh.com/t/bug-in-trying-reference-type/11866/1 "2022-04-12T10:34:20Z")

</div>

Hi guys. I am a newbie in this forum. Hope I can find an answer here.

I watched Mosh’s beginner Java tutorial on Youtube and tried out reference type today. But there is a bug in running Mosh’s example on my Windows 7 computer, as shown in the screenshot. Does anyone know how to fix the issue? I have already followed Mosh’s steps in writing the code.

Thanks a lot!

 ![reference type (point)](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/8/840134b3f9935e9f7da8b8843f107484f937133a.jpeg)

---

<div class="post-metadata">

**Author:** ![eelsholz](https://avatars.discourse-cdn.com/v4/letter/e/439d5e/32.png) [@eelsholz](https://forum.codewithmosh.com/u/eelsholz)\
**Post date:** [April 13, 2022, 1:25am UTC](https://forum.codewithmosh.com/t/bug-in-trying-reference-type/11866/2 "2022-04-13T01:25:37Z")

</div>

I think the problem is near those red squigglies. Maybe it should be

```java
Point point1 = new Point(1, 1);

```

---

<div class="post-metadata">

**Author:** ![barryberry24](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@barryberry24](https://forum.codewithmosh.com/u/barryberry24)\
**Post date:** [April 13, 2022, 10:40am UTC](https://forum.codewithmosh.com/t/bug-in-trying-reference-type/11866/3 "2022-04-13T10:40:13Z")

</div>

yes yes it works now. Intellij automatically adds “x:” and “y:” before the two numbers.

Thank you so much eelsholz!  
 ![reference type no bug](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/8/8a89b897a3b72986147725c26fad7c2a2bc044aa.jpeg)

---

<div class="post-metadata">

**Author:** ![VanessaKol](https://avatars.discourse-cdn.com/v4/letter/v/a8b319/32.png) [@VanessaKol](https://forum.codewithmosh.com/u/VanessaKol)\
**Post date:** [November 8, 2022, 11:22am UTC](https://forum.codewithmosh.com/t/bug-in-trying-reference-type/11866/4 "2022-11-08T11:22:30Z")

</div>

I face the same problem, I use visual Studio code and extensions.

---

<div class="post-metadata">

**Author:** ![VanessaKol](https://avatars.discourse-cdn.com/v4/letter/v/a8b319/32.png) [@VanessaKol](https://forum.codewithmosh.com/u/VanessaKol)\
**Post date:** [November 8, 2022, 12:07pm UTC](https://forum.codewithmosh.com/t/bug-in-trying-reference-type/11866/5 "2022-11-08T12:07:38Z")

</div>

Problem:  
There can be only one public class per source file. You have to put it into another file to avoid this.  
If the class is in the same package or equivalently in the same source directory, you don’t have to import it.

---

<div class="post-metadata">

**Author:** ![jmrunkle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/jmrunkle/32/3765_2.png) [@jmrunkle](https://forum.codewithmosh.com/u/jmrunkle)\
**Post date:** [November 9, 2022, 6:51am UTC](https://forum.codewithmosh.com/t/bug-in-trying-reference-type/11866/6 "2022-11-09T06:51:32Z")

</div>

Pretty sure that has nothing to do with this particular issue.
