Most voted "java" questions
Use this tag when the question refers to some resource, information, or problem relating exclusively to the Java programming language. Java is a class-based, statically typed, reflective, and execution environment (JRE) language. Java programs are compiled to bytecode and run on a virtual machine (JVM), allowing a "write Once, run Anywhere" philosophy (WORA).
Learn more…14,468 questions
Sort by count of
-
1
votes1
answer50
viewsUsing another class Return
Good morning friends, I’m trying to implement this code but it’s giving error. public int totalFaltasAluno(int matricula) { int totalFaltas = 0; for(Integer item : faltas){ if(item == matricula){…
-
1
votes1
answer274
viewsError inserting data with Spring
I am entering data that the user type in the console, I take these values with the class Scanner of Java and play in the Postgres database using Spring Boot. The problem is when I will insert a…
-
1
votes1
answer747
viewsBreak line after a number of characters without cutting the word
I’m trying to solve a little java dojo: Write a program in which given a sentence and the amount of columns that can be displayed on the screen, break lines without breaking the words. For example,…
javaasked 5 years, 5 months ago Brandow Figueira 23 -
1
votes1
answer427
viewsHow to send data between Activitys without opening another window? Android Studio
Good afternoon gentlemen, I have a question in my code, I need to pass the data from one Activity to another but when I put the value it opens the same screen twice, it is working but when a value…
-
1
votes1
answer2178
viewsError creating a Restful Web Services with Spring Boot - Whitelabel Error Page -
I am trying to create a Restful Web Services with Spring Boot, however my page is showing the following error: Whitelabel Error Page This application has no explicit mapping for /error, so you are…
-
1
votes1
answer142
viewsCannibal Dinner Problem in Java
I am doing a college job at Threads and found myself in a complicated situation that since the beginning of the week I do not solve hehehe The problem is the Cannibais Dinner and I’m developing in…
javaasked 5 years, 5 months ago José Peixoto 31 -
1
votes0
answers435
viewsHow to implement simply chained circular list based on a simply chained linear list?
Hello folks how to implement simply chained circular list based on a simply chained linear list? Method of inserting element in a given position: @Override public void adiciona(E elemento, int…
javaasked 5 years, 5 months ago Luciano Douglas 33 -
1
votes0
answers71
viewsVBA Getobject using variable in Windows 10 registry Swing Project
Hello. I have a problem with a component here in the company. The application is built in Swing with java 6. We use a framework called Jintegra. We have a feature where the user clicks on the button…
-
1
votes0
answers29
viewsJasperreports - Is it possible to work with datasource with dynamic (non-static) method?
I am trying to generate a report powered by a web service. The idea is that when the user calls the report generation command he (the command) calls a method that will bring back Java Beans from a…
-
1
votes1
answer626
viewsSort string containing letters and numbers
I have a list of objects that has an integer and a String (composed of letters and numbers). I would like to sort by that integer and as a second clause the alphabetical/numerical order of the…
-
1
votes2
answers503
viewsCreate function that calculates Java irreducible fraction
I am developing a challenge in Java, and I need to create a function that calculates an irreducible fraction to solve the problem. I created a function from some search but the function does not…
-
1
votes0
answers56
viewsSending and Returning variables from a separate asyncTask in a separate java class
I am developing a program that consists of inserting variables, processing them through an Asynctask in a separate java class called backgroundWorker and returning values, according to the drawing…
-
1
votes0
answers25
viewsInteracting with images
Talk guys.. I’m new in the area, but I’m looking to study a lot.. I started with java, I already did a lot of "things", small business automation software and Talz.. however, I wanted to make a new…
-
1
votes1
answer142
viewsPsqlexception: ERROR: target lists can have a maximum of 1664 entries
I am trying to persist an object in the database but I get this error: WARN: SQL Error: 0, SQLState: 54000 ERROR: ERRO: listas de alvos podem ter no máximo 1664 entradas Advertência: A system…
-
1
votes0
answers43
viewsMethod Using Array - Doubt
Good night, Personal is it possible to create a method that by setting only the product attributes already add the list in the array? If yes, could you give me a hint? This is only part of the code…
-
1
votes2
answers603
viewsSending Email with Java
This code that I am using to send email by Java last time I used in 2017 worked, however, I am trying to use it now and it does not work in any way, it does not send me the email in any way. package…
-
1
votes1
answer108
viewsMapping with Inheritancetype.JOINED Does not work
I’m trying to solve a college activity where specifications were passed to map the classes with JPA. I have the following inheritance to map: Employee (parent class), Seller (daughter) and…
-
1
votes0
answers43
viewsJava web mapping with xml
Hello, I am learning java for web, and I have a certain problem, I am not able to do the mapping in the xml file for the links of the pages to be cleaner. I have the following class:…
-
1
votes1
answer374
viewsCompare values of a vector with a matrix
I am new here and beginner in programming, I would like your help, I need to make an algorithm that simulates the mega sena, I must present a matrix with bettors and dozens of bets, a vector with…
-
1
votes2
answers430
viewsRegex to get different snippets of a file
I need to make a regex that takes the address of the person. I can receive 2 types of text with the address. In the first case it comes alone, and get with this regex:…
-
1
votes1
answer241
viewsWhere to place the @Produces and @Consumes annotation? In the method or class?
I have been studying the operation of REST Apis in Java and came across two different didactics. In one of them the teacher placed the notes in the definition of the class, this way:…
-
1
votes0
answers49
viewsHow to display histogram in a Jpanel?
The main program, whose code I didn’t put here, has a button that opens this frame, whose code is down here. I want to display a histogram within that frame. import java.awt.BorderLayout; import…
-
1
votes0
answers78
viewsPutting dynamic legend on graphics with Chartjs?
I am trying to put subtitles dynamically in my graphic, however all the examples I have seen on the Internet so far are directed to the frontend part (with HTML or Javascript), while in my case the…
-
1
votes2
answers468
viewsDoubt Springboot + Restful
I’m having a problem with my Rest requests. Until a while ago my code was working normally, but one to two weeks ago, my requests stopped working, except for GET and Delete methods GET…
-
1
votes2
answers117
viewsWhy do you enter if even if it is false?
Even though the condition is false, he enters the if, always assigning the last position in both cases. However, when assigning the for in the variable index notas, works properly. For this code to…
-
1
votes1
answer114
viewsI have a Java class where one of the attributes is an Arraylist of another object. How to bring this from the database?
I have a java object that looks like this: public class Objeto1 { private int id; private int nome; private ArrayList<Objeto2> lista; //construtor e Getters e Setters } How do I get this list…
-
1
votes1
answer141
viewsTag destination - mail tracking (JAVA)
Good afternoon, everyone! I am working with the maintenance of a JAVA application integrated with ERP J.D. Edwards, where we have an interface to retrieve tracking code information from the post…
-
1
votes2
answers55
viewsError searching/searching for attribute in a vector
In this program with you insert the object peacefully in my vector with the method (Adder), but after I cannot fetch the string "plate" that the user typed... program always shows "Vehicle not found…
-
1
votes1
answer254
viewsAndroid app does not access API on the latest SDK(28) - Android Studio
Good morning, I developed an app using android studio that does not access web service in a version of the android SDK, more specifically the SDK 28. I already declared on android manifest the…
-
1
votes1
answer44
viewsHow to set fields on pages
Please inform if I need to improve the explanation. I am trying to create a report in Jaspersoft Studio composed of three sections: customer information (a Javabean containing name, email, date of…
-
1
votes0
answers299
viewsRun Spring Boot project without Datasource and Jdbctemplate
I have a project Java with Spring Boot that has to be mult-tenacy and for that I’m trying to use the Flyway to execute the migrate() by an endpoint passing the data needed to connect to a specific…
-
1
votes2
answers92
viewsDiv hidden/visible does not disappear when you click the search button
Good night, I have a page with 3 Divs and within each div has a different form, I leave all the Divs hidden and make them appear as the value selected in a first combobox(select) option that is…
-
1
votes1
answer20
viewsHow to find error lines in a CSV file upload?
I am implementing a CSV file upload, currently I am able to count how many lines has the CSV, I am able to identify when errors exist in the CSV as shown in the algorithm below; File arquivoLeitura…
-
1
votes2
answers162
viewsEquals() and Hashcode() superscript
I’m learning to use the equals() and hashCode(), and I was taught that Eclipse overwrites this method for us. But I’m trying to buy two attributes to tell if one object is the same as the other.…
-
1
votes1
answer721
viewsHow to create a @Onetomany relationship in JPA, in 3 tables that already exist in the database?
I want to create a relationship @OneToMany in JPA using 3 tables I have already created in my database (I don’t want it to create the tables for me), the tables are Usuario, Perfil and…
-
1
votes2
answers51
viewsTablecellrenderer, problem in color display in table
Here’s the thing, I want to change the font color a specific part of my table when the user’s payment is up to date to blue. Otherwise, I want it to change to red. I want only the "situation" column…
-
1
votes1
answer2449
viewscom.google.gson.Jsonsyntaxexception: java.lang.Illegalstateexception: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
Hi, I’m new here and I’d like a hand. I happen to be developing a work of distributed systems in which the client is in Java and the server in Python. For there to be communication between the two,…
-
1
votes0
answers46
viewsError when connecting to Java JMS message with activemq
I’m creating a rudimentary chat for a university job, using JMS and Activemq You’re giving me this mistake that until then I couldn’t understand which mistake is this and why javax.jms.JMSException:…
-
1
votes1
answer71
viewsHow to hide part of a view?
I have the Stickerbtn.java with the following code: public class StickerBtn extends View { private Bitmap mControllerBitmap private void init() { mControllerBitmap =…
-
1
votes0
answers39
viewsShow latest chat messages
Well, here’s the problem. I’ve been developing a What’s App-style app for a long time. As simple as it sounds, I can’t get the latest chat messages (sent by the user X received from the user Y) to…
-
1
votes0
answers106
viewsDatabase cache not being stored by Springboot
I am trying to store the cache of a database search made through JPA, for that I am using the annotation @Cacheable of the package org.springframework.cache.annotation upon the method…
-
1
votes1
answer480
viewsHow to read and save an object to a java file
Personal What can I do to read an object from a file correctly? What is the problem with my code? import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import…
-
1
votes1
answer229
viewsMultiple shipments in Spring Boot
I’m having trouble sending several images, I receive all the files and in the loop I do the interaction, but only send and register an image. I’m doing it wrong? Follow the project in my github…
-
1
votes2
answers281
viewsClass that implements two interfaces that have identical signature methods
I have a class that implements two interfaces. Each of these interfaces has an identical method, for example: public interface InterfaceA{ void doSomething(String params); } public interface…
-
1
votes1
answer212
viewsHow to Make Dynamic Tablayout in Android Studio
I created a tablayout in my application, I need that by clicking on one of the menu options, it automatically takes the 0 position. Where the house would be would be an icon to return and the others…
-
1
votes0
answers38
viewsHow to persist and query embeddable entities that have no bidirectional relationship using Jparepository
Using as an example a hotel booking app, I have something like public class Reserva{ ... @CollectionTable(name = "custo_extras", joinColumns = @JoinColumn(name = "reserva_id")) private…
-
1
votes2
answers143
viewsClone a list in Java
I have a class that reads a csv file and puts the table data on a list. public class Gerenciador { public LinkedList<Acidentes> listAcidentes; public Gerenciador() { listAcidentes = new…
-
1
votes0
answers234
viewsHow to close the current screen after opening a new javafx
well I have this code that will open a new screen but the old screen is still open: if (conn.resultset.next()) { MenuPrincipal p = new MenuPrincipal (); code: /* * To change this license header,…
-
1
votes0
answers62
viewsDoubt on popular combobox giving setAttribute Java Web - Servlet, jsp
Why are not populating the two combobox? It seems that when I leave two setAttribute, it considers only one... This is the combobox of the filled groups... Java class code in the Command package:…
-
1
votes1
answer46
viewsWhy is the marker placed at the wrong coordinates?
I want to do a program that puts a marker where the phone is. In the case, I put the latitude and longitude of a city in Greenland, but the value of the final location is (37.42342342342342,…