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
answer65
viewsDatabase query with java
I will make a comparison with my problem using a database functionality and html Jquery. With Jquery we have the possibility to visit the database and bring the data to the frontend in HTML, and…
-
-2
votes1
answer284
viewsOptional.ofNullable with ifPresent
If the property ano is null but the model and year are filled, will save the car data in the repository ? public Class Carro { int ano; String modelo; int valor; } public void carro(final Carro…
-
-2
votes1
answer184
viewsRemove value quotes in Jsonobject on Android
In my Android project I need to generate the following Json result: {"value":164.40} However, how to remove the quotes from the String result? JSONObject json = new JSONObject(); json.put("value",…
-
-2
votes2
answers1446
viewsHow to pick up array index?
I have the following APEX code List<integer> entrada = new List<integer>(); public static void generateStringArray(integer entrada){ List<String> ListaPrincipal = new…
-
-2
votes1
answer36
viewsConnection 4 to mongodb.net:27017 closed
I’m learning to work on Mongodb and out of nowhere, this "mistake" starts to appear. Does anyone know how to fix it? Programming language I’m using: Java
-
-2
votes1
answer49
viewsPrint values from 1 to N
I want to start testing a code and for that I wanted it to start printing values from 1 to N. example: input: 7 output: 1,2,3,4,5,6,7
javaasked 6 years ago Lucas Nascimento Távora 51 -
-2
votes1
answer161
viewsPalindrome in Java
Could someone help me with this exercise by explaining? Ex: Write a Function that checks if a Given word is a palindrome. Character case should be Ignored. For example, isPalindrome("Deleveled")…
javaasked 6 years ago game-extreme 3 -
-2
votes1
answer390
viewsDoubt about construction method
Guys I started studying java and I have a question about the main method, I have a project to do and I would like to do if in the main method I can by functions and other methods as for example…
-
-2
votes2
answers30
viewsImages in the Mysql BD in the java language
Iqeria know how to insert images into the database so that when I can search the image and its data appear.
-
-2
votes1
answer334
viewsHow to connect a socket over the internet
I recently started studying sockets and I know that to create a server I use a port and to connect a client I use the port and the server ip on the local network, but I would like to connect a…
-
-2
votes1
answer94
viewsDifficulty writing a REGEX to validate URL
I’m having trouble creating a regular expression that validates the following URL: https://firebasestorage.googleapis.com/v0/b/nome-app/* *would be anything! Someone could give me a related surpote?…
-
-2
votes3
answers734
viewsHow to compare Arrays?
I need to make the comparison of several Array, to search for equal values... Rules of Business There may be an array with values larger than the other. There may be Array with the same amount of…
-
-2
votes1
answer32
viewsjava.lang.reflect.Invocationtargetexception in Javafx
I’m having a problem when loading a file with the Fxmlloader method, as in the image below. I don’t have this problem when I do a screen without using an FXML file, someone knows why of the error?…
-
-2
votes1
answer2480
viewsCan you program in java by creating frame by VS code?
I’m learning java swing and wanted to know if there’s a way to do a Jframe and run vs code, because I want to start using just one ide for everything and netbeans takes too long to start, and how to…
-
-2
votes1
answer141
viewsJava failed to locate the main class of my program
Hello, I am beginner in java I made a very simple project hello World and I am compiling in the terminal and when I put to run gives error. Name of the file ta Primeiroprogama.java package…
javaasked 5 years, 9 months ago Eliabe Santos 1 -
-2
votes1
answer101
viewsThreads in Java
This is the first time I’ve been working with Threads. I created two threads, one to run the report generator (iReport) and one to operate a progress bar (Jprogressbar). However, even using flag,…
-
-2
votes1
answer196
viewsHow to export database data, generate a csv and download?
I have a sales screen, where the user selects a customer, a product, the quantity and makes the purchase, this information is recorded in the database. I need a button on the sales screen that…
-
-2
votes1
answer726
viewsNetbeans cached an deleted class and does not recognize another class
I have different packages in my project, and by mistake I ended up creating two classes with the same name, let’s assume Aluno.java, but in different packages. I deleted one of them, and even after…
-
-2
votes1
answer74
viewsDoes connecting to a java database have to be by a main class only?
To make a connection to the java database, I only have to do it through a main class or I can do it through another class?? public class ConexaoBasica { public static void main(String[] args) throws…
-
-2
votes3
answers724
viewsIgnore the first line of a file
I would like to know how to ignore a line in a file .csv, because the first line is a kind of title. try (BufferedReader br = new BufferedReader(new FileReader("C:\\temp\\apartamentos.csv"))) {…
-
-2
votes1
answer1008
viewsVIEW DATE BY PHP SPELL
Guys, next.. I have a contract printing page where I need to convert the field date in full <?php echo $result->estado?> - <?php echo $result->data_contrato?> In the…
-
-2
votes2
answers214
viewsI need help Variavel i
I need help on this issue: Write a step functionPath(), which prints 5 times the content of i . For example: passoAPasso() “01234” Make a.log(value) console for each iteration. I made the formula:…
-
-2
votes1
answer79
viewsSet the value of a get(); on a map
How do I put the value of ipOrigem being a string? And also, without refactoring the method that has objects used in several others. List<FileVO> arquivos = digitalizacaoVO.getArquivos();…
-
-2
votes1
answer35
viewsRandom values for a Java exercise
I’m wanting to make a sum exercise application, it should do a search in the database where will be registered the 3 values(val1, val2, rest) as I make this search in the bank be random???
javaasked 5 years, 2 months ago Igor Paslauski 3 -
-2
votes1
answer108
viewsSendredirect error in Interceptor
I am studied Java Web and need to make an application with access restriction. Restricting access if the user is not logged in (i.e., the session created), if the user accesses a URL without being…
-
-2
votes1
answer791
viewsTo create a Postgresql database using Spring Boot you need to have Postgresql installed?
I’m following a tutorial on how to create a Rest API using Spring Boot. The commands I’m using on application.properties to create the bank are these:…
-
-2
votes1
answer73
viewsData does not save in Firebase
I’m trying to save data in my Firebase database but the app doesn’t save. I can install, boot the app, and move between pages without an app crash, but I can’t save data. Before implementing the…
-
-2
votes1
answer49
viewsStream Filter == List.get(index) does not compile
I’m trying to create a Stream to filter a list of a class with several attributes. One of these attributes is repeated in other instances. I’m trying to filter these instance members to make a sum…
-
-2
votes1
answer76
viewsHow do I work with chained Hashmap in Java?
I’m trying to popular a DTO through a received Json, in case I’m the Gson library, but I’m having trouble filling the field urlPhoto of my class hotelDTO. I can even convert Json to a Hoteldto…
-
-2
votes2
answers187
viewsNullpointerexception JPA with springboot
I have a problem that I believe is simple, but I’m having a hard time. To be more clear, I will summarize the idea of the project: I have a Client class and an Update class. The update class has as…
-
-2
votes2
answers1035
viewsListing files from a folder
Hello I am using Jfilechooser to pick up files on the system. Only now I need to use Jfilechooser to select folders and add all their contents in the program. I used DIRECTORIES_ONLY and it worked.…
javaasked 8 years, 4 months ago Pedro Henrique 75 -
-2
votes1
answer21
viewsHow to define the data types of the columns of a Jtable equal to the Mysql database?
I created a graphical user interface in Netbeans where I inserted a Jtable into a Jframe FORM. I have a Mysql database whose columns are: Id: Integer Name: String Active: Boolean But when I use:…
-
-2
votes2
answers163
viewsPower in Java other than Excel
I’m having a problem to convert an Excel formula to Java/Kotlin. The scenario is as follows, in Excel I have: Interest rate: 0.07 Excel calculus: =(1+taxaDeJuros)^12-1 = %125.22 No Kotlin: val…
-
-2
votes1
answer48
viewsRecyclerview Does not load on screen
My Recycler view does not appear on the screen if anyone can help I’m a beginner so I’m struggling, but I managed to do two other only that is keeping me awake :/ Thank you very much =] MY ADAPTER…
-
-2
votes1
answer39
viewsHow to show the person’s name on the welcome screen?
<jsp:useBean id="calcula" class="br.com.projetojsp.bean.UsuarioBean" type="br.com.projetojsp.bean.UsuarioBean" scope="page" /> <%@ page language="java" contentType="text/html;…
-
-2
votes1
answer425
viewsHow does the new Java operator work?
I don’t understand how new works below: public Main(){ System.out.println(""); } public static void main(String[] args){ new Main(); }
-
-2
votes1
answer49
viewsHow to Shuffle String Value? (JAVA ANDROID)
The thing is, I’m creating an android app and I prescribe shuffle the value of a string. Example: String name = "Bruno"; Shuffles the string value(name). Output: "ronub"…
-
-2
votes2
answers1209
viewsDoubts about how to consume Ws Nfs-e Curitiba
Now following my return only comes so <EnviarLoteRpsResposta xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <NumeroLote xsi:nil="true"…
-
-2
votes1
answer50
viewsPOO doubt object
I have a question about POO... Classe objeto=new Classe(); ...from what I understand, we create a variable that receives a reference from the created object. In a simple chained list when I delete a…
-
-2
votes1
answer16
viewsJava help, logical expressions
write a logical expression to determine whether a person is a voter or not. consider that they are voters, persons aged 16 or over
-
-2
votes1
answer52
viewsRuntime recursive function
How I calculate the running time of a recursive function? public void ordenar(int vetor[],int i,int f){ boolean aux2=true; int inicio=i,fim=f; while(i<f){ if(vetor[i]>vetor[f]){ int…
-
-2
votes2
answers57
viewsRecyclerview does not display data
I have a problem where Recyclerview does not render on Activity. Textviews load normally. In the Emulator I use level 24 or 30 Apis and physical applications. This appearing this way, the Recycler…
java android android-layout android-recyclerviewasked 4 years, 1 month ago Filipe IKOGNYT Andrade 1 -
-2
votes2
answers130
viewsSeparate String in Java Character
Guys, I’m trying to separate a string into characters...for example, if I type "race" I want it to come out "c o r i d a", but I’m not getting it, where I’m going wrong? import…
javaasked 4 years ago MariaClara 5 -
-2
votes1
answer46
viewsHow to scan the matrix using only one for?
The circumstances are in the code that works: String[][] compras = new String[][] { { "item 1", "1.70" }, { "item 2", "39.90" }, { "item 3", "9.90" }, { "item 4", "4.90" }, { "item 5", "7.90" } };…
-
-2
votes1
answer44
viewsCommand is not working
I have a code to remove an index that was typed by the user, only it is not working properly, it erases two values when it was to delete a single one, or else it erases a position that was not…
javaasked 3 years, 11 months ago Daniel freitas 1 -
-2
votes1
answer14
viewsCan an Enum table in the database store more than one value for the same element?
public enum SitucaoEnum { INCLUSAO(1), CANCELAMENTO(2), ATUALIZACAO(3), FINALIZACAO(4); } Can I save more than one such value in a type Enum column in the database? Or only rescue of one Enum per…
-
-2
votes0
answers17
viewsImplicit column Reference in the @Mapsid Mapping fails, Try to use Explicit referenceColumnNames
I have these tables in my database: create table movimentacao ( id bigint not null, usuario_id bigint not null, data_entrada datetime not null, data_saida datetime, periodo_permanencia…
-
-2
votes0
answers17
viewsCode to show current announcer name online (on air:)
blz? I am new in programming and I would like your help in making a code, script or something like that that shows the name of the online speaker at the moment or current programming in a Web Radio,…
-
-2
votes1
answer106
viewsJava array problem to read from database
I have a Java function where I weigh a phone number and it returns me which trunk the call will exit according to the regular expression that is saved in database in a column called…
-
-2
votes1
answer1127
viewsHow to fill an Arraylist with values of another Arraylist caught randomly?
I have the class Vetor which will have a method to start an array with random numbers: public class Vetor{ private int tamanho; private int[] vetor; public Vetor(int tamanho) { this.tamanho =…