Skip to content

Tag: java

Validate string like “abc=def,123,xyz” with regex

I would like to verify the syntax of an input field with a regex. The field should accept text like the following examples: There has to be a word, a = sign and a list of comma separated words. The list must contain at least one entry. So abc= should be invalid, but abc=123 is valid. I am using a

Extraneous input ” expecting {‘ ‘, ‘} – Antlr4

I have a text file which am parsing through antlr4. Text format Grammar Rules I get this What am i doing wrong and how could i make these rules better? Answer Your example input get properly parsed if you start with the init rule: prints: which looks like this indented: My guess is that the error you’re…

Jax-rs annotation Path is not work in java spring boot?

I have spring boot application with starter version 2.1.16, and spring-boot-starter-web dependency. So, i want use javax.ws.rs-api library, and add dependency: So when i create controller, and add @Path, @Get – i don’t get answer from the server (404 not found). How makes it work? Answer Add the f…

Printing multiple user input from a loop

This is a two part question. 1) how do I print all userinput if the loop runs more than once , I am aware the old string assigned to the variable gets erased each time. 2) how do i calculate the total task duration across all tasks for the amount of times the loop runs. thanks. Answer You can create

How do I restart Snake game (Java)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 7 months ago. Improve this question I’m a beginner so I used Bro Code’s (a YouTuber) version of s…