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
-
-2
votes1
answer681
viewsHow to get an item from a List< [ ] String>?
How can I pick up an item from a List< [] String>? // Monta a String partsList.add(new String [] {StringUtils.trim(String.valueOf(peças.getCodigoProduto())),…
-
-2
votes2
answers70
viewsHow to remove 1 element from the Labels vector
Label[] posi={textf99, textf00, textf01, textf02, textf03, textf04, textf05, textf06, textf07, textf08, textf09, textf10b, textf11, textf12, textf13, textf14, textf15, textf16, textf17, textf18,…
-
-2
votes1
answer127
viewsException java.lang.Numberformatexception (files)
Guys, by what I checked this code is all correct, including after the String[] linha = arquivo.split(","); if we give a System.out.println(linha[0] + linha[1] + linha[2]) he returns right TV LED…
javaasked 5 years, 10 months ago Kevin Ricci 165 -
-2
votes1
answer234
viewshow to create an arraylist of a class that has another arraylist as parameter?
public class Entra extends Fluxo { private int periodo; private boolean fixo; public static ArrayList<String> prods = new ArrayList<>(); public static ArrayList<Entra> entra = new…
javaasked 5 years, 9 months ago lucas pereira 23 -
-2
votes1
answer214
viewsName of the MYSQL Server
I am following a video lesson in which the instructor puts the name of your server in ODBC as it appears in mysql, but as my version (Mysql Workbench 8.0.15) is different and does not include the…
-
-2
votes1
answer41
viewsData pass dispatcherServlet
I am trying to perform data export from Log to Excel only it is presenting me the following error: 2019-03-18 10:16:16.022 ERROR 252 --- [nio-8080-exec-4] o.a.c.c.C.[.[.[.[dispatcherServlet] :…
-
-2
votes1
answer72
viewserro_persistence_mysql8.0_hibernate_eclipse
Guys, I’m in my first persistence class, but the code is not working, **mysql persistence file:* <?xml version="1.0" encoding="UTF-8"?> <persistence…
-
-2
votes1
answer150
viewsHow do I leave a JPA transaction with Spring open?
I would like to know how to leave a JPA transaction with spring open, today I use the annotation @Transaction what happens is that every time I want to carry some attribute that is not like EAGER…
-
-2
votes1
answer43
viewsDeserialization Gson X Android
I am unable to pass the value of the JSON string to an entity (OBJECT). I’ve already managed to receive JSON, and code 200 success. But I can’t put that value on the object (Deserialization). if…
-
-2
votes1
answer97
viewsExercise should show a result but shows 3
An algorithm that reads 3 integer values, not repeated, and shows in descending order. But it is showing 3 results, and should only be 1 package praticando; import java.util.Scanner; public class…
-
-2
votes2
answers81
viewsCreate a Run Class
I need help to run a class, it’s a college exercise, I don’t know how to finish. Only this last class left to finish the project. I need to create a class TesteProjeto with the structure main. In…
javaasked 5 years, 6 months ago user148170 -
-2
votes1
answer67
viewswriteln is obsolete in Javascript or not?
I have a simple code example <html lang="en"> <head> <meta charset="UTF-8"> <title>teste</title> </head> <body> <script> var nome = "maria"; var…
-
-2
votes1
answer65
viewsI want to save 3 numbers and then print on the screen
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] vet = new int[2]; int i; for (i=0; i<2; i++); {…
-
-2
votes2
answers700
viewsHow to know how many positions an array has in Java?
Look at the picture; I’m uploading a CSV file, and I’m already able to count how many lines there are, in our context are three lines as shown in the code below; However I need now and how to get…
-
-2
votes1
answer458
viewsJava field with numbers only
I’m doing a medical record for a hospital system test and I’d like to know how to validate the field CRM. It is a variable double, I want the field of Joptionpane accepted only numbers in CRM, I’ve…
-
-2
votes1
answer64
viewsHow to calculate item price from random quantity of items sold?
I’m solving a problem, and one of the parts of it is calculating the price of an item based on the random amount of this same item sold. For example: 4 items were sold, so the method should…
-
-2
votes1
answer33
viewsI need to develop a program that given an input file, generates a java output file
Given an input file, generate an output file as shown below Arquivo de Entrada | Arquivo de Saida --------------------+-------------------- 1 | impar 2 | par 3 | impar 4 | par 5 | impar 6 | par I…
javaasked 5 years, 5 months ago Breno Nogueira 37 -
-2
votes1
answer87
viewsWhat is the name of the bottom bar of Android and how to manipulate it?
In my application I removed the background from the status bar with the following code: Window g = getWindow(); g.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,…
-
-2
votes1
answer48
viewsHow to fix NULL object bug?
I am creating loading objects to perform unit tests, but the object I am working for is null as shown in the red arrow below, on line 39, and I can’t understand why this is happening, I need help to…
-
-2
votes1
answer28
viewsResponse Em Restfull
Good evening, I’m new to Webservice and I have the following question, how do I make a response to the class created in java? So far I’ve done it in my code: package alarme; import…
-
-2
votes2
answers65
viewslength() giving Nullpointerexception
I am creating a program that will receive multiple inputs from the user and, when receiving a blank string, should stop receiving entries and continue with the program. The code runs perfectly…
javaasked 5 years, 4 months ago Diogo Neiss 25 -
-2
votes1
answer207
viewsSort Map<String, Map<String, Map<String, Long>>
Hi, I did a search but I couldn’t find this sort of sorting by the last value of this Map. I need to order a Map<String, Map<String, Map<String, Long>>> for the last Long value, to…
-
-2
votes1
answer251
viewsDoes anyone have any idea how to mount a multiple alarm system using the Workmanager library?
I am developing an application that works as "Alarm" to take the medicines at the right time. I am trying to use the "Alarmmanager" Repeating to run these alarms. However, some problems are…
java android android-studio android-service android-alarmmanagerasked 5 years, 3 months ago Andre Alas 54 -
-2
votes1
answer140
viewsI can’t seem to instantiate an object
I’m unable to instantiate an object from the Student class Pupil Class public class Aluno extends Pessoa { private int matricula; public Aluno(int id, String nome, String endereco, String telefone,…
-
-2
votes1
answer206
viewsParking Stack
The question asks to use battery in a parking lot, which has only one entrance, which serves for exit as well. I’ve already made 80% of the question,my main problem is being in counting how many…
javaasked 5 years, 2 months ago user160874 -
-2
votes2
answers62
viewsDouble appearing dice
I wonder why when I run this code it shows twice the name of the client and employee, and how to solve to appear only once package modelo; import java.util.Date; public class Pessoa { public int…
-
-2
votes1
answer23
viewsProblem setting an object from a remote ejb
I’m having trouble using a Set of a remote EJB object, this object will be sent to the same EJB and there will make a connection to the bank or a webservice(As it is a company application I can not…
-
-2
votes1
answer134
viewsBufferedimage does not appear on the screen
I’m learning Java and I needed to use Bufferedimage, but for some reason this doesn’t seem to work Error is that the drawing does not appear in the panel, I followed several tutorials but still not…
-
-2
votes1
answer110
viewsProblem with showing Bufferedimage in Java Jpanel
I’m learning Java and I needed to use Bufferedimage, but for some reason this doesn’t seem to work Error is that the drawing does not appear in the panel, I followed several tutorials but still not…
-
-2
votes1
answer106
viewsWhat can be done to improve this code?
class Curso { public List<Disciplina> disciplinas; } class Aluno { public List<Disciplina> obrigatorias; public List<Disciplina> optativas; public matricula(){ ... } } class…
-
-2
votes1
answer188
viewsPrimary key generation problem spring-boot-jpa
I’m creating a little project using spring boot,: org.springframework.data.relational.core.conversion.DbActionExecutionException: Failed to execute…
-
-2
votes2
answers900
viewsReturn JSON from API with parameter
Hello, I have a service that consumes the Openweather API. There is a list of cities registered in the view layer. Where you can see the weather forecast for each city by clicking on the 'forecast'…
-
-2
votes1
answer81
viewsSave Date to a mysql database using Java
I am creating an application that has a mysql database containing a table of banks and another of banking movements. The bank movements table has the following attributes: Bench Movement date…
-
-2
votes1
answer73
viewsERROR: array required but (class) found
Good afternoon. I’m creating an algorithm for matrix multiplication, following the linear Algebra property. I chose to create a class with attributes: row and column, after obtaining these values by…
javaasked 5 years, 1 month ago vinicius peres 13 -
-2
votes1
answer405
viewsFill a select according to another select with Jquery
Someone can help me with this logic? Next I am filling a select Manufacturer with data from a json using Jquery, the problem is that I can not think of a way to fill the other select Model according…
-
-2
votes1
answer43
viewsProblem with variable data manipulation
I’d like to pick it up, class Botao, the value that is stored in the variable aux and compare it with a string in the class Janela class Botao extends JButton{ public String aux; Botao(Menu menu,…
-
-2
votes1
answer643
viewsHow to browse a java chained list
I need to go through a chained list to compare whether the number the user will enter is equal to an attribute of a class (doctors) that has a chained list. I have the following Classes: Node,…
-
-2
votes1
answer77
viewsPlease help - Exception in thread "AWT-Eventqueue-0" java.lang.Numberformatexception
I am trying to save the total value of a sale, however the following error is being displayed : Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "199,67" at…
-
-2
votes1
answer1128
viewsError Request method 'GET' not supported while performing update
Good colleagues. I have a mistake I haven’t solved yet. I wanted to create a feature in my application that I am developing with spring mvc. The goal was to click the button or link it changes the…
-
-2
votes1
answer213
viewsSpring data Jpa Lanca @Autowired error and null pointer error
I’m using Spring Tool Suite to make an application, but when I try to release the website’s html data to the database, the relative service method will save and generate persistence returns…
-
-2
votes2
answers117
viewsAutowired instance with null value
Problem I am working on a Spring Boot project that depends on other project, these projects are my entities, services and the like. I use the note Autowired to inject my dependencies, example:…
-
-2
votes1
answer40
viewsError while creating a file
For some reason you can’t create a file. W/System.err: java.io.IOException: No such file or directory Follow the code below: public class MainActivity extends AppCompatActivity { ImageView…
-
-2
votes1
answer42
viewsArrayindexoutofboundexception error when trying to store values in the array
I am trying, through the Scanner, to take the values typed by the user, to store in a vector and finally, to average the values typed, in the case the average of a student’s grades. However, I’m…
-
-2
votes2
answers145
viewsWhat are the disadvantages of protecting a string of objects from a nullPointerException using the optional map?
For example: public static void main(String[] args) { Cidade cidade = new Cidade(); Estado estado = new Estado(cidade); Endereco endereco = new Endereco(estado); Loja loja = new Loja(endereco);…
-
-2
votes1
answer88
viewsProblem checking for an array
I was doing a very simple old game, and the same done, I wanted to leave the automatic win check, because it was very "hard-code". The way I found to do this was by running a for, and whenever it…
-
-2
votes1
answer397
viewsCheck ordered sequence (in ascending or descending order)
A sequence of integer numbers, check that it is ordered true (in ascending or descending order), otherwise false. If a number has the same value as the number below, it will not break the order. The…
-
-2
votes1
answer39
viewsorg.apache.Maven.reactor.Mavenexecutionexception: Failed to validate POM for project
I’m having a little problem with my pom giving the following message: Validation Messages: [0] 'dependencies.dependency.version' is missing for com.fasterxml.jackson:jackson-bom:pom Reason: Failed…
-
-2
votes1
answer148
viewsWhenever I run the app, it closes itself
Good afternoon, I’m having a problem and can’t solve it. Every time I try to test the app on the phone it closes alone: Logcat: 2020-05-09 16:02:58.397 30691-30691/com.leandrel.Uri E/Androidruntime:…
-
-2
votes2
answers1468
viewsJava Multiple Numbers and Primes
Write a Java code to print from 1 to 100 in ascending order, stating whether the number is even, odd, multiple of 3, 4 or 5. If the number is multiple of 5, write another "for" inside the "if" for,…
-
-2
votes1
answer179
viewsLoop on an Object with an array variable
{ List<PedidosPendentesOBJ> listaPedidos = new ArrayList<>(); List<ProdutosPendentes> produtosList = null; JSONObject o = new JSONObject(ret); JSONArray ts = o.names(); for (int i…