Ask coding questions

← Back to all posts
packages
Bunnytoes

I tried used packages to use stuff from different files, but Styles style = new Styles(); style("red"); doesn't work

Answered by SixBeeps [earned 5 cycles]
View Answer
Voters
Bunnytoes
Comments
hotnewtop
SixBeeps

Styles(String style) has a capital S at the beginning.

Also, why are you instantiating the Style class if it doesn't have any instance methods?

Bunnytoes

@SixBeeps idk, I got it working I forgot to do style.Style

Coder100

the Style method is static so instantiating the class won't do anything. You don't need to instantiate the class. @Bunnytoes

Bunnytoes

@Coder100 ok but just putting Styles("red); doesn't work

SixBeeps

@Bunnytoes You need to refer to the class that the Style method comes from:

As in, "I want to call the static Style method from the Styles class."

Bunnytoes

@SixBeeps I know, I figured it out

SixBeeps

@Bunnytoes Then why are you still instantiating it?

Bunnytoes

@SixBeeps I didn't fix it

Coder100

because you never made that method global, it has to be Styles.Styles remember? It's a method! @Bunnytoes

Bunnytoes