Which data structure to use
CodeGuru Forums » Java Programming
by kakemonsteret
3M ago
I have the following structure of data I need to store and fetch in a Java class: ID Address 1 Address 2 Address 3 .... --------------- -------------- ------------------ -------------- 3482f899bbs7293 Address line 1 Address line 2 ... ... 3482f899bbs7293 Address line 1 Address line 2 ... ... This needs to be a data type or custom class in a ScenarioState object, so that I can add entries - first the initial line with the ID and an address, and then later add more adress lines to a specific ID. Then I need to be able to fetch the address line(s) for a specific ID. Basically, a very simple da ..read more
Visit website
Slight problem with fraction calculator code
CodeGuru Forums » Java Programming
by michaelmackay
6M ago
Hi, im new to Java but am ambitious to learn it. I have a slight problem with my code, Code: public class Fraction1 {       // ============================================================     // Instance variables     // ============================================================       /**     * The numerator of the fraction.     */     private int numerator;     /**     * The denominator of the fraction.     */     private int denominator;        ..read more
Visit website
Swagger Integration in Spring Boot: API Documentation Challenges
CodeGuru Forums » Java Programming
by Nathan D
7M ago
I'm currently working on a Spring Boot project and integrating Swagger for API documentation. While the basic setup is clear, I'm facing challenges in ensuring comprehensive and well-organized documentation. Here's a snippet of my Swagger configuration: Code: @Configuration @EnableSwagger2 public class SwaggerConfig {         @Bean     public Docket api() {         return new Docket(DocumentationType.SWAGGER_2)                 .select()                 .apis(Reque ..read more
Visit website
DZone Research and TechnologyAdvice Survey: Enterprise Security
CodeGuru Forums » Java Programming
by jamespayne
8M ago
Calling all AppSec experts! How do you approach security across the SDLC? What cloud security and supply chain threats impact your team? Share your insights on all things AppSec in our 7-minute research survey (+ enter to win 1 of 4 $125 e-gift cards). In DZone's December Trend Report, you'll find results gathered from our community of global software professionals — and see how your experiences compare. https://survey.alchemer.com/s3/7581720/taforums ..read more
Visit website
Best Practices for Exception Handling in Java
CodeGuru Forums » Java Programming
by Nathan D
8M ago
What are the best practices for handling exceptions in Java? How can developers create reliable and maintainable code by effectively using try-catch blocks, custom exceptions, and exception propagation strategies? Please provide examples of common scenarios and how to handle them using Java's exception-handling mechanisms ..read more
Visit website
TechnologyAdvice and DZone Survey
CodeGuru Forums » Java Programming
by jamespayne
8M ago
CodeGuru has partnered with DZone, who is conducting their annual Observability + App Performance research survey, and we want to hear from YOU! Taking ~7 mins., our questions cover topics like observability, performance monitoring, and site reliability. The purpose of this survey is to understand how you and your organization design, build, monitor, and observe your software and systems with the objective of maximizing performance. We define "performance" broadly to include efficient use of computational resources, data analysis, observability, end-user experience, predictability, and recove ..read more
Visit website
Play for Ozzy (my program is not working correctly)
CodeGuru Forums » Java Programming
by 357mag
1y ago
I have this cool program that uses a logical operator to join two conditions in an if statement. Basically for a person to get a job playing for Ozzy Osbourne you have to play a LesPaul and you have to have long hair. I did this program in C++ and I think it's cool so I wanted to transpose it over to a Java program. But for some reason the statement in the if part does not run. Even if I enter LesPaul and Long the program wants to skip the statement that says "Congratulations you've got the gig!", and it wants to always print "Sorry you do not qualify for this gig". I don't know why it wants ..read more
Visit website
A simple hand with Java Pattern Matching?
CodeGuru Forums » Java Programming
by Zachary1234
1y ago
I have had a good go at using Java OpenJDK, necessarily a very early version of the OpenJDK, in order to try and match expressions like the following, which are going to be certain kinds of doubles in exponential, E, notation: Code: import java.util.regex.Pattern; import java.util.regex.Matcher; import static java.lang.System.*; //... Pattern pattern = Pattern.compile("^[0-9]+\\.0{15}?|9{15}?[0-9]+E-?[0-9]+$");       Matcher matcher = pattern.matcher("3.0E-4");       boolean result = matcher.matches(); out.println("Pattern match result: " + result + "."); I ..read more
Visit website
Variables can be passed through a Spotify account and redirected to a specified URL.
CodeGuru Forums » Java Programming
by Coreycoder
1y ago
I encountered an issue while programming a bot. Summary and function When a user types !add spotify:track:someHash in a chat-application, I invoke a java-function which then triggers a PHP-script. I have been using this git-project, following the instructions in the documentation for authorization, and I am able to add my tracks to the source by manually inputting the code. Allow me to demonstrate the essential elements. HTML Code: if (spotifyTrack.startsWith("spotify")) {     // this might be important, maybe need to change this?     URL url = new URL("http://www.examp ..read more
Visit website
Need help with json please
CodeGuru Forums » Java Programming
by wildstorms
1y ago
Hello i new to this forum hope every one doing well weather website and starting to learn json as i am using willy weather api need hope with this code please what am, Idoing wrong [CODE] [H Code: {     "CONTENT_TYPE": "application/json",     "HTTP_X_PAYLOAD": {         "platform": "iphone",         "weatherTypes": [             {                 "code": "weather"             }         ],       &nbs ..read more
Visit website

Follow CodeGuru Forums » Java Programming on FeedSpot

Continue with Google
Continue with Apple
OR