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
answer18
viewsI’m trying to make a chronometer program using java FXML in Scene Builder and I can’t
Every time I click the button, in an attempt to start the chronometer, this error happens: Exception in thread "Thread-4" java.lang.IllegalStateException: Not on FX application thread; currentThread…
-
-2
votes1
answer68
viewsError in mappedBy when making 2 user relationship
i have two classes one of user and one of request, my user class has roles and in the order class I want to know who was the employee and the client who made the request and am having this error…
-
-2
votes2
answers787
viewsRegex that accepts only letters or letters and numbers
I’m trying to make a regex in Java that accepts: only letters; letters and numbers cannot have only numbers cannot have punctuation characters or special My difficulty is that I cannot make a regex…
-
-2
votes1
answer73
viewsI’m doing an exercise and I don’t know why it’s going wrong (print exercise in the post attachment and my code below), what’s wrong?
Myio is used by my teacher to replace scanner and etc the strings I’m going to use in the exercise are large and diverse so any example you think about is the basis. is my first post, I’m sorry if I…
-
-2
votes1
answer133
viewsjava.lang.Nosuchmethooverthrow: No virtual method group(Ljava/lang/String;)Ljava/lang/String;
Oie I have a problem with an app in Android Studio, it compiles and runs on my phone, but when I click on some button it gives this error. Error: E/AndroidRuntime: FATAL EXCEPTION: main Process:…
-
-2
votes1
answer38
viewsI’m a beginner in java and I’m looking to learn more about it, so I’d like to know how to know if the threads are running?
import com.sun.corba.se.spi.orbutil.threadpool.ThreadPool; public class Game { private boolean isAlive; public static void main(String[] args) { if(args.length…
javaasked 4 years, 2 months ago Patrick Soares 1 -
-2
votes1
answer24
viewsHow can I take the result of the imc to and put in another Textview??? I tried this way
public void btCalcularIMC(View v){ float altura, peso, imc; altura = Float.parseFloat(edAltura.getText().toString()); peso = Float.parseFloat(edPeso.getText().toString()); …
-
-2
votes1
answer31
viewsHow do I create a Java class that is like: Minhaclasse<T extends Comparable<T>?
I am trying to start a class that is a Bubble Sort that extends a class called Comparable. My code is like this: public final class BubbleSortPassPerItem<T extends Comparable<T>>…
javaasked 4 years, 2 months ago Pirategull 659 -
-2
votes1
answer133
viewsAPI Rest Spring boot
I’m developing an API to register clients using Rest and Spring, I can already add customers and search by Id, but I would also like to be able to search by name and I’m not getting, would anyone…
-
-2
votes2
answers80
viewsReturn Null Print Java
I’m developing an exercise where I need to create a class Ponto and add to an Array of points without me using ArrayList, when testing the first option in the menu I received a return that the array…
-
-2
votes1
answer56
viewsDelete firebase user
Good afternoon, I’m having trouble settling an issue. I’m inside a fragment programming my delete account button, but it’s not working, nothing happens when I click on it, I think there’s something…
-
-2
votes1
answer38
viewsCheck if there is already value inside the Array and listview?
How can I make sure that no values are repeated inside the Array and listview? I’m making an app for "registration" code. It has an Edittext, and a send button, when clicking it takes this Edittext…
-
-2
votes1
answer95
viewsHow to request parameters within Java
Good evening guys! I’m looking to develop a program for my work that will make it much easier to do what my boss asked. The problem is that I stopped at a part of the code. I already searched on the…
javaasked 4 years, 1 month ago Theo2017BR 1 -
-2
votes1
answer232
viewsError while trying to connect Mysql database to eclipse using JDBC
I’ve tried some solutions, I’ve reinstalled Mysql and Workbench, but it doesn’t seem to accept my password. It just keeps giving the same error. Note: I did not change the user name in the database,…
-
-2
votes1
answer267
viewsHow to create and write txt file in java?
I would like to know how to create and write in txt file. The goal is to write in CSV standard, tried with Bufferedwriter and did not work... import java.io.*; public class…
-
-2
votes1
answer42
viewsHow to extract String from a database query?
I am implementing a query screen, the user will have to enter the name and after the fields below will have to be filled in. My question is how to perform the consultation? I tried to make Select…
-
-2
votes2
answers175
viewsReturn of prime numbers?
I’m having trouble with some returns stating that some prime numbers are not primes. What is the error in my code? package capitulo4.laboratorio; import java.util.Scanner; public class Laboratorio1…
-
-2
votes1
answer29
viewsJPA Speciffication - Filter entity list
I have a "Request" entity with a task list (another entity) and need to use speciffication to filter the requested entity and the nested task list. Example: Select * Order where tarrefa.finalizada =…
-
-2
votes1
answer36
viewshow do I see the total
I’m creating a college shopping app, I need that when I press the add button it shows the value of the specific product in total and that it adds together the following values when pressed the add…
-
-2
votes1
answer15
viewsShow database values in a Jlist on screen
Hello, I am creating an application that needs to show some registered elements in a list, which I will show through Defaultlistmodel. Unfortunately within the application it recognizes the elements…
-
-2
votes1
answer55
viewsHow do I repeat a password check?
I am learning Java and decided to make a simple program of login, but I wanted that when the password went wrong he asked again to put the password but I do not know how to do. Can someone help me?…
javaasked 3 years, 8 months ago Guilherme Jordão 9 -
-2
votes2
answers113
viewsQuit command in java string, show name and number after typing QUIT
Create a program to accept the typing of a person’s name and phone, while the name typed is different from QUIT. When typed EXIT, show the name and phone number of the first and last person typed,…
-
-2
votes1
answer34
viewsJava conditional
package aplicativo_enel; public class A1_Residencial { //Atributos entrada de dados int imposto1; final int ICMS1 = 0; private float leitura; private final float TE = 0.25588f; private final float…
-
-2
votes1
answer24
viewsCall variable in another main
I no longer know what to do, I need help. I want to print out all customer registrations and saved in public static void clientes(), but for the impression I created a public static void imp(), and…
javaasked 3 years, 7 months ago Marco Antônio 1 -
-2
votes2
answers34
viewsTravel variable keeps at 1 in the Firebase database, when button is pressed, instead of adding 1 more to the database
Hello, for some reason the travel variable is not adding 1 more to the Trips field in Firebase, when the pegLoc button is pressed, could you help me? , Follows below code: public class Mainactivity…
-
-2
votes2
answers35
viewsProblems running the DDL on a Rest Api via JPA
When I go to execute I realize this mistake: org.hibernate.tool.schema.spi.Commandacceptanceexception: Error executing DDL "create table tb-product (id int8 not null, name varchar(255), quantity…
-
-2
votes2
answers36
viewsI cannot show an exception when I set a value that my foreign key does not exist in JSON when I will persist
I own a Lancamento class that inside it I have 2 foreign keys that would be pessoa_codigo e categoria_codigo, I managed to create an exception when I report a non-existent value for any of these…
-
-2
votes1
answer23
viewsRepeat process upon receiving invalid entry
I am unable to make this program repeat after the user has put an invalid answer. If he/she type a response does not validate how it could be done for the program to run again to be put the response…
-
-2
votes1
answer41
viewsProblem when making a POST request
Hi, I’m trying to make a POST type request with Bearer token for an endpoint. When I perform this request by the postamn it returns normally, but when it is performed by the method I created using…
-
-2
votes2
answers47
viewsHow does the get() method work?
I wanted to understand the method get(), how it works and what is it serving in this code (preferably wanted an explanation of imaginary form without technical names). package exemplo_oo; public…
javaasked 3 years, 6 months ago x7MKDeath7x 49 -
-2
votes2
answers164
viewsHow to format a double number to N decimals without rounding?
I have a type value double and I would like to format it so that it gets 3 decimals only, unfurnished. For this, I’m trying to utilize the String.format as follows: float value =…
-
-2
votes1
answer76
viewsError: Unable to access jarfile
I’ve been trying to deploy my application to Heroku for weeks and I always get errors. i had a dynos error, I created a Procfile file with the following content: web: java -Dserver.port=$PORT…
-
-2
votes1
answer40
viewsHow could I make sure that the text is not duplicated
I was developing a Java application that basically creates a 4 x 4 matrix, which has to count and write how many values greater than 10 it has, until I was able to do this, but the text that asks…
-
-2
votes1
answer85
viewsException error in thread "main" java.lang.Numberformatexception: For input string:
I’m having trouble getting my program to return the IF in a correct way, when I put the FOR it counts the number of times it is in the variable, if I type an input less than 14 it instead of falling…
-
-2
votes1
answer25
viewsReturn the date value selected in the datapicker in a variable
Good afternoon community, first question here. I have a datepicker fixed on a div in my code, not an input!! and I’m not able to take the selected value and store a variable because I need to later…
-
-2
votes1
answer22
viewsQRCODE Having Ireport Problems
My Qrcode is printing as follows on iReport, this way is in trouble: Correct would be in this format: I have already realized all the necessary configurations for the operation of it. 1 - I added…
-
-2
votes0
answers28
viewsError importing package and running code in eclipse JAVA IDE
Hello I’m new in java and I have a problem, I’m trying to run a java code I saw on internet recognition and sound pattern but there is a problem when I replicate it in IDE import everything and do…
-
-2
votes0
answers30
viewsProblem in access control
Hey guys, I’m having a problem with my access control, instead of making it impossible to enter the home screen without logging in, it’s letting you enter the home screen and blocking the login…
-
-2
votes0
answers15
viewsError sending simple JAVA email
I have a problem trying to send an email in Java I’m using Apachenetbeans. Could someone help me? package bancoteste; import org.apache.commons.mail.DefaultAuthenticator; import…
-
-2
votes1
answer46
viewsMethod that returns False and to While True
public boolean para () { return false; } public void acao (int acao) { if (acao == 1) { System.out.println("Diga quanto quer depositar: "); Scanner sc = new Scanner (System.in); double valor =…
-
-2
votes0
answers20
viewsCalculate the percentage of two groups in relation to the total number of people (groups)
Good night guys! I’m new here and also in programming. I want to know what is the percentage of two groups of people in relation to the total number of people. However, I am not able to create this…
-
-2
votes0
answers20
viewsCalculate month by month the profit in a program with IR
I did an interview test, but I didn’t pass. I would like someone to help me correct this exercise; Create a Main class that receives an initial value from the user, and simulate month by month how…
-
-2
votes0
answers20
viewsCheck if an Arraylist has an item with the same name
I need to check if an arraylist has such a name, and if that name already exists in the arraylist, do not let the user continue and register. I have the Products class: public class Produto {…
-
-2
votes0
answers9
viewsJupyter notebook install Ganymede
Hey guys, I’m trying to install Ganymede so I can use Java, Javascript and Kotlin in Jupyter Notebook. I have already installed in Jupyter, Python and C#. But whenever I try to run the command to…
-
-2
votes0
answers50
viewsDo we have a function that returns memory space allocated to the local variable in Java?
Dear people, because I am a layman I believe it may be a question outside the scope but the idea of the question is: a declared variable will always be in a space allocated in memory, will this…
javaasked 3 years, 3 months ago Gabriel Galdino 3 -
-2
votes1
answer19
viewsHow to Browse a List With Map and Array List Within the Same List (JAVA)Springboot
I need to go through this List (List) however I cannot, I need to pass the value "options",take the value "option_Id", and go through the option_value and bring the option_value_id and Name in…
-
-2
votes0
answers32
viewsJava database connection codes, do you really understand what is happening or write the code? I write
People speak the truth, when it comes to connecting to the database, you understand right what’s going on? Or just save the codes to type the sql queries as I do? This is very difficult to…
javaasked 3 years, 3 months ago Deny Programador PHP 53 -
-2
votes0
answers15
viewsReplace all repeated numbers with the value 0 and display the number of unique numbers of the vector
import java.util.Scanner; public class Vetor { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("DIGITE O TAMANHO DO VETOR: "); int N =…
javaasked 3 years, 3 months ago user255315 1 -
-3
votes2
answers829
viewsHttpclient releasing org.hibernate.Exception.Genericjdbcexception exception exception?
Is there any reason for the following code to release this exception? I have one webservice who consults at my bank and turns everything into xml and then make a send to another webservice takes the…
-
-3
votes2
answers2058
viewsError connecting JDBC to local sql Server
I try to connect java with Sql Server from my local machine but I get this error com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1434 has failed.…