#Java help

50 messages · Page 1 of 1 (latest)

vast barn
#

I have no idea on how to start this. Please help

mild mantle
#

How about you get a simple Hello World working.

#

Any examples from your class?

vast barn
#

Alr got hello world

#

This all the basic I know rn

mild mantle
#

Okay, so you know how to define variables. So do something similar like you did with money, and define one for x1.

#
int x1 = 1 + 1;
#

For example.

vast barn
#

Alr so like this?

mild mantle
#

exactly.

#

And then print it out!

vast barn
#

So I jst do that for the rest?

mild mantle
#

yes, mostly

vast barn
#

Alr lemme see if I get stuck again lemme do this rq

#

I jst didn’t know what it was asking me to do lmao

#

Alr bro im stuck again

#

So on problem C what do I do for x3

#

Cause y3=4

#

And I can’t put 4 right

mild mantle
#
int y3 = 4;
int z3 = 3;

int x3 = y3++ + ++z3;
vast barn
#

So I jst put that?

#

And print it out?

mild mantle
#

Yep.

vast barn
#

So like this correct

mild mantle
#

Seems fine, but it does ask only the print x(n), e.g x3.

vast barn
#

Ah so jst the last one

#

Alr so now I don’t understand the last 3

#

Cuz D has two X, and E has a less then symbol and F has 2 X with *

#

Nvm I got it it’s pretty much copy and print for all of em right

vast barn
#

Actually can’t get F) x6*=3; to work

#

I put

#

int x6* = 3;

mild mantle
#

*= is a operator.

vast barn
#

System.out.println(x6*);

#

So it wouldn’t be defined as in Int?

#

Or how would it go

mild mantle
#

What do you mean?

vast barn
#

Uh idk

mild mantle
#
int x6 = 5;
x6 *= 3;
vast barn
#

Is that how it’s defined?

mild mantle
#

Well, you first declare x6, and initialize it to 5.

#

Then you redefine it with *= which is equivalent to, x6 = x6 * 3;

vast barn
#

Uhh I think I get it kinda

#

So if for ex: i*=8 it is i = i * 8

#

But then what do I print out