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
votes2
answers130
viewsShow the highest average of all calculated averages
I created an algorithm to calculate the average of a surfer, but he can take as many Ndar as he wants if he wants to stop the algorithm has to show the highest average of those calculated and move…
javaasked 7 years, 7 months ago Pedro Aguiar 15 -
-1
votes2
answers100
viewsProblems in creating class and method
I have the following code: public class String verifyWord(String wordChosen, Scanner reader){ //linha 1 boolean answeredCorrectly = false; int tries = 1; String wordChosen = random.nextInt(); String…
-
-1
votes1
answer552
viewsHow to take time from one field and add up to 3 minutes in another?
I’d like to know how to get to the time of the field txt_hora and move on to the txt_hora2 adding up +3 minutes. In case on the field one would be 09:50 and move on to the other 9:53. Here I enter…
-
-1
votes1
answer394
viewsError code in Switch Case
I have to do the following exercise: Make a program in Java that requests the total amount spent by the a store, print the payment options, request the desired option and prints the total amount of…
-
-1
votes3
answers577
viewsPassing attributes from a Servlet to a JSP
Hello. I’m developing a system where the user clicks on an edit button and then opens the editing page with the attributes of the already filled object in the text boxes. In my Servlet, I am using…
-
-1
votes1
answer148
viewsMy app does not return JSON data
I’m making an app and in a part of it the user can update the login data, just enter the screen that the data is loaded and filled, automatically. The problem is that in fact this is not happening!…
-
-1
votes1
answer52
viewsIs it possible to create a Widget with multiple configuration screens?
I have a Widget that there is only one configuration screen but want to add one more how can I do it? I know that the first screen that appears is a Activity try to open with Intent normal but not…
-
-1
votes1
answer405
viewsSwap screen (xml) with login button
I am developing an application. It has the option to login. I wanted to know how to move to another xml layout when login and password validated. The login system is almost ready. I put in the tab…
-
-1
votes1
answer278
viewsPut Firebase link on each button of the app on Android
I need the image button to get the link to Firebase to download the image of the application. I will present my App to be clearer. I have this app: I was able to use the text and image of Firebase…
-
-1
votes1
answer89
viewsDo While is not working properly
Do while is not working in the code. At first the test that I am doing now is only the first of the menu (register the user) and then should go back to the menu until S is typed. (It is running only…
-
-1
votes1
answer89
viewsGet last sql server information from netbeans jdbc
I am using this way to try to bring the latest information registered in sql server, but for some unknown reason it is not working. I searched in several forum and apparently is used the same method…
-
-1
votes1
answer57
viewsResult 0.0 - even with Typecast or changing variable types
I have this method in the secondary class to calculate the median of a vector: public class Funcoes { .... public void setMediana(int[] valores) { double med; Arrays.sort(valores); int meio =…
-
-1
votes1
answer455
viewsTo show database query result within a jtextarea
How do I display the data of a query in a database, within a Jtextarea? I did all my list method (which is in the Carrodao class), and I want it to show the data inside the textarea (which is in the…
-
-1
votes1
answer335
viewsJtable Autosorter in columns
Personal I am a few years with a difficulty that even today I could not solve completely. By adding a TableRowSorter to a JTable automatically the columns can be ordered by clicking and with that I…
-
-1
votes1
answer111
viewsJava code error read GSON: java.lang.Nullpointerexception
I’m trying to read this file but when I run it shows this error: Exception in thread "main" java.lang.NullPointerException at principa.Main.main(Main.java:61) but I do not know what this null public…
-
-1
votes2
answers410
viewsHow do I lock the selected Radiobutton?
I created a RadioGroup with 3 RadioButton internal, however I cannot fit a code that makes the user when selecting a RadioButton is prevented from selecting another. <LinearLayout…
-
-1
votes1
answer1390
viewsHow to upload multiple images using spring boot
I am developing a Mangas project and want to save several photos in the database. Paginascontroller @RequestMapping(value="/pagina", method = RequestMethod.POST) public @ResponseBody…
-
-1
votes1
answer175
viewsHow to make a class to manipulate Graphics2d in Paint?
In the following code I tried to create a Sprite class to manipulate the drawings, its function would be to transform the sprites into Graphics2d and use it in the Paint. But the only way I could…
-
-1
votes1
answer710
viewsHow to dynamically change model data when changing the value of the list that fills it?
I have a Jtable where I have a column by the name of colun1 I want to know how I can alter Jtable’s data when any data on the list that fills it out changes. Example I have a list with listString…
-
-1
votes1
answer218
viewsI made an application/game in java and used MVC. However, I have already concluded and I did not put anything in the Model, is that correct?
I made an application/game in java and used MVC. But I have already completed the application and I did not put anything in the Model. I did everything in the Controller and View. My application…
-
-1
votes1
answer496
viewsAdd element in Jlist
This one-button action serves to add the path of a file into a JList: private void bArquivoActionPerformed(java.awt.event.ActionEvent evt) { JFileChooser fileChooser = new JFileChooser();…
-
-1
votes1
answer45
viewsError in code by classes
Good.I have now started to study java programming that includes several classes in which one flame another. But I’m facing a mistake I can’t understand. I looked for codes with similar effect and I…
-
-1
votes1
answer190
viewsJSP scriptlet code for EL
How can I rewrite this JSP code using Expression Language? <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html> <html>…
-
-1
votes1
answer1649
viewsHow to call a method within another method?
I am developing a quiz. Using as Radiobutton response. So far I have created using the onClick method on each Radiobutton, but it is not effective. So I’d like to call every question ask1();,…
-
-1
votes2
answers162
viewsHow to pass data from one button switch to another acivity?
I’m developing a mobile app on AS that has a list of cardviews. In these cards I have a switch button that clicking on will open an Alert dialog to confirm the status change. However I’m having…
-
-1
votes2
answers321
viewsError installing jdbc oracle in eclipse
I am finding impediments in the installation of oracle jdbc. Canvas Error message: Error Reading file C: Users alex.jose.silva.m2 Repository with oracle ojdbc14 10.2.0.3.0 ojdbc14-10.2.0.3.0.jar C:…
-
-1
votes1
answer109
viewsHow to print only numbers that repeat between two different lists?
I have two lists of 50 numbers. One has multiples of 3 and the other multiples of 7. Code: public static void main(String[] args) { List<Long> lista1 = new ArrayList<>(); List…
-
-1
votes1
answer930
viewsProblems Installing Java 7 on Ubuntu
Hello! I am trying to install Java 7 on Ubuntu. I used the following commands: ~$ sudo apt-add-repository ppa:webupd8team/java ~$ sudo apt-get update But at that moment returns the following…
-
-1
votes1
answer39
viewsFuture call with Void type
Situation I needed to print a PDF report through a void method that returned Replay and after screen printing it became necessary to invalidate the permission key directly in the bank. Problem Soon…
-
-1
votes2
answers315
viewsError in code - Arrayindexoutofboundsexception
int[][] A = {{11, 7},{-20,-22}}; int[][] B = {{A[0].length},{A.length}}; for(int i = 0; i < A.length;i ++){ for(int j = 0; j < A[0].length;j ++){ System.out.print(A[i][j] + "\t"); }…
javaasked 7 years, 1 month ago Rui Duarte 1 -
-1
votes1
answer102
viewsReading File in java running line specifies if it exists
I am reading java file that has the following structure: nomedapessoa;data de nascimentodependente1+tipodependente2+tipodependenteN+tipo There may be none, one or several dependents in each line of…
javaasked 7 years, 1 month ago julio alves 1 -
-1
votes1
answer183
viewsHow to do a while without locking the application in Java
I’m building an application in college that I need to run a code for 2 minutes and minute to minute to do an evaluation of the system and the variables that are in it. I’ve looked on the Internet,…
-
-1
votes1
answer185
viewsHow do I update a Jlabel?
I need to update a Jlabel every time I press a particular button that searches for a database form to generate a chart, but it only works the first time. My idea was this: if Jlabel is empty it adds…
-
-1
votes1
answer1409
viewsHow to create a tree with n children per node?
I would like to know how to implement a tree where each node can have n children? As in the example below: Only in case the nodes would be an instance of a class. EDITED I’m trying to do this with a…
-
-1
votes1
answer47
viewsSqlitedatabase db error = this.getWritableDatabase();
public ArrayList<String> addMigracaoCadIndividual(String QUERY){ SQLiteDatabase db = this.getWritableDatabase(); return null; } java.lang.Nullpointerexception at…
-
-1
votes1
answer84
viewsWildfly server memory error
I tried to import a 66 megas file, and gave this error in wildfly : Caused by: java.lang.Outofmemoryerror: Java heap space In addition to including this setting in spring. @Bean public…
-
-1
votes1
answer77
viewsfile reading with scanner
I would love to know if anyone can help me with this code below, in my application the user will often upload some files and they have two information, number and name separated by -> ; but in…
-
-1
votes1
answer1242
viewsjava.lang.Nullpointerexception: Attempt to invoke virtual method 'java.lang.String java.lang.String.toString()' on a null Object Reference
I have a problem on line 141, where it says that the string is null and points out the error on this line JSONObject jsonObject = new JSONObject(response.body().toString()); However I am not able to…
-
-1
votes1
answer69
viewsSearch in the Database
I’m in doubt on a role of how to do a comic search. It’s going to catch. Can anyone tell why? And how to solve? That is the function public void consultar(){ String sql ="select * from tbaluno where…
-
-1
votes1
answer84
viewsReport not found when running . jar
In netbeans it finds the normal report, but when I go through the jar, it is not finding. I have seen some topics here about this problem, but still I could not solve, because they say that is just…
-
-1
votes1
answer127
viewsMove the highest value of an Array to the end of it.
I need to create a method that takes the highest value of an Array and passes it to the end of that Array, so that the array is ordered, without losing any value. I tried several ways and I still…
-
-1
votes1
answer38
viewsLogical operator out of commission?
Hello I’m doing a project in java that involves stacks and queues, however so far so good, but among some conditional that I did with if one of them "presented" an error (In fact do not present or…
-
-1
votes1
answer73
viewsJava Error - Scheduled
I am encountering the following error when trying to compile the image code. I created a project just to test the code, and this comes up. I found no similar mistake elsewhere, someone can help me?…
javaasked 6 years, 11 months ago Camila C. Piva 31 -
-1
votes1
answer1083
viewsError: java: Illegal char<:>
am experiencing this error Error:java: Illegal char <:> at index 4: http: api.jquery.com I know what error is in the sentence, but I can’t find it anywhere to fix it. I’ve searched line by…
-
-1
votes2
answers137
viewsvalues of a Java list
Guys good night! I’m writing a code that requires a number to be multiplied by itself 200 times so well, but what I’m not getting is to print 10 values in the same line forming a total of 20 lines…
-
-1
votes2
answers117
viewsHow to pass a java object array to Asynctask? My problem is that when I use this looping in Asynctask pq only comes first user [0]
ControlaBanco bd = new ControlaBanco(contexto); int indice = 0; indice = bd.contaUsuarios(); Usuario[ ] tabela = bd.organizaTabela(); String tabelaOrganizada = ""; if ( indice > 0 ) { for (int i…
-
-1
votes1
answer46
viewsJava Nullpointerexception error in construction
main java. package projeto; import java.sql.*; import javax.swing.JOptionPane; import java.sql.Connection; import java.sql.Statement; import java.sql.DriverManager; import java.sql.ResultSet; import…
-
-1
votes2
answers97
viewsCreate a program that is usable on Windows
I am a programming student, still in the first year of my course. So far I have studied Java, C, Haskell and Script Shell. I’m quite functional in Java and C. I can write code, compile and exceed in…
-
-1
votes1
answer41
viewsHow to return an sql answer?
This is my first forum post, so I apologize if I make a mistake. The thing is, I need to register a book in the bank, but before that, I need to know if the author is already registered in the bank,…
-
-1
votes1
answer51
viewsSqlite with java, error
I have made a database of Bank Bank Accounts, each of these accounts has its own id to identify, and has his tipo, to know what type of account the user is accessing at that time, type, he can have…