# Professional Dev training. It cant compile my program? No idea why. anybody can help on variables

**URL:** <https://forum.code.org/t/professional-dev-training-it-cant-compile-my-program-no-idea-why-anybody-can-help-on-variables/38164>\
**Category:** Coding and Debugging Help\
**Created:** [June 13, 2023, 4:53pm UTC](https://forum.code.org/t/professional-dev-training-it-cant-compile-my-program-no-idea-why-anybody-can-help-on-variables/38164 "2023-06-13T16:53:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![proslak138](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@proslak138](https://forum.code.org/u/proslak138)\
**Post date:** [June 13, 2023, 4:53pm UTC](https://forum.code.org/t/professional-dev-training-it-cant-compile-my-program-no-idea-why-anybody-can-help-on-variables/38164/1 "2023-06-13T16:53:06Z")

</div>

public class MathPractice{

public static void main(String args){

```
// TO DO: 
// 1. Declare and initialize two variables of type int. 

```

int x;  
int y;  
x=5;  
y=6;

```
// 2. Declare and initialize a variable to hold the sum of the two variables you created.

```

sum=x+y;  
// 3. Declare and initialize a variable to hold the difference of the two variables you created.  
diff=x+y;  
// 4. Declare and initialize a variable to hold the product of the two variables you created.  
pro=x+y;  
// 5. Print the sum, difference, and product to the console.  
System.out.Println(sum,diff,pro);

}  
}

---

<div class="post-metadata">

**Author:** ![lindsay.davis](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/lindsay.davis/32/7632_2.png) [@lindsay.davis](https://forum.code.org/u/lindsay.davis)\
**Post date:** [June 14, 2023, 11:39pm UTC](https://forum.code.org/t/professional-dev-training-it-cant-compile-my-program-no-idea-why-anybody-can-help-on-variables/38164/2 "2023-06-14T23:39:16Z")

</div>

Hi Kevin,  
I took a look at this code snippet and I think I see what could be the problem- on steps 2,3,4 the variables must be declared with a type since those are the first times those variables are appearing in your program.  
Try changing those steps to what I have here, I **bolded** the new parts:

```auto
// 2. Declare and initialize a variable to hold the sum of the two variables you created.

```

**int** sum=x+y;  
// 3. Declare and initialize a variable to hold the difference of the two variables you created.  
**int** diff=x-y;  
// 4. Declare and initialize a variable to hold the product of the two variables you created.  
**int** pro=x\*y;

Then, in step 5’s print statement, the p in println must be lowercase. Also, the part you put into the println statement won’t understand the commas how you have them. You could just do separate print statements for each like:

System.out.println(sum);  
System.out.println(diff);  
System.out.println(pro);

I hope this helps! Sometimes fixing one issue brings about a new one, but this will hopefully get you closer 🙂

Lindsay

---

<div class="post-metadata">

**Author:** ![proslak138](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@proslak138](https://forum.code.org/u/proslak138)\
**Post date:** [June 15, 2023, 2:45pm UTC](https://forum.code.org/t/professional-dev-training-it-cant-compile-my-program-no-idea-why-anybody-can-help-on-variables/38164/3 "2023-06-15T14:45:08Z")

</div>

Lindsay,

Thank you so much and for the quick response. I taught AP CSP and know my basics well, but as you know it is a little frustrating when you try to debugg and you can’t get the code to compile correctly. I will keep you in my contacts (forum) and I am sure you will hear from me again

Have a wonderful day!

Kevin

> ![](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/lindsay.davis/45/7632_2.png "lindsay.davis") | [lindsay.davis](https://forum.code.org/u/lindsay.davis) [Code.org](http://Code.org) CSA & CS Principles facilitator  
> June 14 |
> 
> - | - |

Hi Kevin,  
I took a look at this code snippet and I think I see what could be the problem- on steps 2,3,4 the variables must be declared with a type since those are the first times those variables are appearing in your program.  
Try changing those steps to what I have here, I **bolded** the new parts:

```auto
// 2. Declare and initialize a variable to hold the sum of the two variables you created.

```

**int** sum=x+y;  
// 3. Declare and initialize a variable to hold the difference of the two variables you created.  
**int** diff=x-y;  
// 4. Declare and initialize a variable to hold the product of the two variables you created.  
**int** pro=x\*y;

Then, in step 5’s print statement, the p in println must be lowercase. Also, the part you put into the println statement won’t understand the commas how you have them. You could just do separate print statements for each like:

System.out.println(sum);  
System.out.println(diff);  
System.out.println(pro);

I hope this helps! Sometimes fixing one issue brings about a new one, but this will hopefully get you closer ![:slight_smile:](https://emoji.discourse-cdn.com/twitter/slight_smile.png?v=12 ":slight\_smile:")

Lindsay

---

<div class="post-metadata">

**Author:** ![proslak138](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@proslak138](https://forum.code.org/u/proslak138)\
**Post date:** [June 15, 2023, 6:23pm UTC](https://forum.code.org/t/professional-dev-training-it-cant-compile-my-program-no-idea-why-anybody-can-help-on-variables/38164/4 "2023-06-15T18:23:56Z")

</div>

You re awesome and your team! I am sure I will have more coming your way this summer as I work through the program…  
Kevin, SVT

---

<div class="post-metadata">

**Author:** ![proslak138](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@proslak138](https://forum.code.org/u/proslak138)\
**Post date:** [August 12, 2023, 2:26am UTC](https://forum.code.org/t/professional-dev-training-it-cant-compile-my-program-no-idea-why-anybody-can-help-on-variables/38164/5 "2023-08-12T02:26:40Z")

</div>

Lindsay,

Really weird, but I tried to access resources, such as google files just like I did last year using the same credentials for [code.org](http://code.org) and I have a school gmail address and I can’t get access to any of the files.  
Can’t make a copy either. I am confused. My [code.org](http://code.org) log in is not a google address, but that has not changed since 5 years ago.

Can you help me or direct me towards somebody, please.

Thanks.

Kevin

> ![](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/lindsay.davis/45/7632_2.png "lindsay.davis") | [lindsay.davis](https://forum.code.org/u/lindsay.davis) [Code.org](http://Code.org) CSA & CS Principles facilitator  
> June 14 |
> 
> - | - |

Hi Kevin,  
I took a look at this code snippet and I think I see what could be the problem- on steps 2,3,4 the variables must be declared with a type since those are the first times those variables are appearing in your program.  
Try changing those steps to what I have here, I **bolded** the new parts:

```auto
// 2. Declare and initialize a variable to hold the sum of the two variables you created.

```

**int** sum=x+y;  
// 3. Declare and initialize a variable to hold the difference of the two variables you created.  
**int** diff=x-y;  
// 4. Declare and initialize a variable to hold the product of the two variables you created.  
**int** pro=x\*y;

Then, in step 5’s print statement, the p in println must be lowercase. Also, the part you put into the println statement won’t understand the commas how you have them. You could just do separate print statements for each like:

System.out.println(sum);  
System.out.println(diff);  
System.out.println(pro);

I hope this helps! Sometimes fixing one issue brings about a new one, but this will hopefully get you closer ![:slight_smile:](https://emoji.discourse-cdn.com/twitter/slight_smile.png?v=12 ":slight\_smile:")

Lindsay
