GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes Pattern Problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Pattern Problems" Watch "Pattern Problems" New topic
Author

Pattern Problems

Eden Landau
Ranch Hand

Joined: Aug 14, 2011
Posts: 40

There seems to be a problem in my pattern, though I can't seem to find it. Any help?

fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11351
    
  16

Why do you think there is a problem? Does this compile? Does it run? Does it not match something you think it should? Does it match something you think it shouldn't? What would that be?

you haven't given us near enough information to even attempt to help you.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7892
    
  21

Eden Landau wrote:There seems to be a problem in my pattern, though I can't seem to find it. Any help?


Fred's quite right, but just hazarding a guess, I'd say that your '+'s are misplaced.

Do you actually want to match the character '+'? Because that's what you're doing.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Eden Landau
Ranch Hand

Joined: Aug 14, 2011
Posts: 40

That would explain, then. Where should I put the +'s?
Eden Landau
Ranch Hand

Joined: Aug 14, 2011
Posts: 40

Also, this is the error the compiler gives me:

Exception in thread "main" java.lang.NullPointerException
at Console.validateString(Console.java:43)
at Console.analyzeString(Console.java:20)
at Console.toNumber(Console.java:230)
at DiceRoll.main(DiceRoll.java:21)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

That's not a compiler error, that's a runtime exception. And the exception tells you exactly where to look - something on line 43 of Console.java is null but you're still trying to access it.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Eden Landau
Ranch Hand

Joined: Aug 14, 2011
Posts: 40

Yeah, I figured that part out, and solved it. Thanks for everyone's help!
 
GeeCON Prague 2014
 
subject: Pattern Problems