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
-
0
votes1
answer812
viewsTraverse array and locate a character other than a number
The idea is to receive a 4 digit number and then perform a variety of accounts but there is an input condition: If in the middle of the 4 digits there is a character that is not a number then I need…
-
0
votes0
answers33
viewsCan I place a ternary operator inside another ternary in java?
I can place a ternary operator inside another ternary in java? (num1 == num2)? System.out.println("Type different numbers! " ):larger = (num1 > num2)? num1:num2;
javaasked 4 years, 5 months ago Eudes Moreira 1 -
0
votes1
answer143
viewsProgram execution error with Spring Boot: null id
So, guys, I got this problem... I am doing "Spring Boot" Development course, and when I went to test the application, the following error appeared: I reviewed this class 2 to 3 times, I changed some…
-
0
votes2
answers664
viewsDifficulty with Permission Location Android
I’m trying to get a project up and running open-source found on the internet but I’m having some problems trying to implement the permissions for Location now required by compileSdkVersion 23 and…
-
0
votes1
answer55
viewsRelationships between classes in the OO
For example, if I have a class Hospedagem and a class NotaFiscal, a lodging has a invoice and a receipt has a lodging. I need to put the attributes inside the two classes, the attribute NotaFiscal…
-
0
votes1
answer58
viewsHow to use javascript to perform math operation
I have the following relationship How do I create a javascript code that counts decimals? For example... if I measure 5.7cm? The account that would be: subtract 110 from 145 and the result divided…
-
0
votes1
answer31
viewsDebug Intellij using Classpath with Project
Hello, could someone help me? I’m starting with Intellij, today I have a project where I use other projects, and to debug the subprojects, in the eclipse added in Classpath "User Entries", if not…
-
0
votes1
answer165
viewsHow to replace a string letter when it is masked?
I’m creating a hangman’s game for further learning of programming logic. 1- I masked the textfield with *** so that the user cannot see the word. 2- In my example, I created 3 buttons, being…
-
0
votes0
answers113
viewsCreate a "Submit" button after creating a "spinner" with email confirmation
I’m new to creating android apps and wanted your help Crier in the Navigation Drawer one Spinner with 2 text boxes, a drop down list and a button of Submit where this button will have to fetch the…
-
0
votes1
answer268
viewsjEnv alternatives for Windows
Currently use jEnv for switching between Jdks on different client projects, but this tool is only for Linux/Unix/Mac OSX. With it, I can easily within each project configure the use of JDK 8.11.14…
-
0
votes1
answer38
viewsProblems inserting an OBJ into a LIST
I’m doing a survey using the LIKE, in the MySQL with JSF. Whenever I will insert the search result inside a array to return to my JSF, the array add, but always overwrite items with the last…
-
0
votes1
answer40
views"super" and private variables
In the case below, it makes sense to call super() in class B_Class since the variable a of A_Class is private? It would be more feasible not to use the parent-class builder? Compiling this code…
-
0
votes1
answer174
viewsHow to concatenate an invoked String from an xml file with a variable?
In Android Studio, I’m trying to concatenate a String I saved in an xml file (strings.xml) with a float variable as follows: gas.setText(String.format("%s %s", R.string.gasoline_mod, value)); The…
-
0
votes1
answer371
viewsDoubt about Eclipse + Java Selenium
I made the following code to perform a simple login test using Eclipse + Selenium: package memoriavirtualWebTesteFuncional; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver;…
-
0
votes1
answer382
viewsHow to convert integer to a char array or integer array
Scanner key = new Scanner(System.in); int num = key.nextInt(); Assuming one is 100, how to convert one to an array of char where: char[0] == '1' char[1] == '0' char[2] == '0' Or convert to an…
javaasked 4 years, 3 months ago pedro henrique 3 -
0
votes1
answer29
viewsHow to know which permissions a dependency uses
I have an Android App made in Java published in the Getnet store, in which their approval system is quite strict and recently had a version of the app reproved because it uses the permission :…
-
0
votes1
answer62
viewsMethod being called several times
I have a little problem. The method of adding Message is being called several times and keeps adding messages until the app is closed.I have no idea what’s causing this,! Fragment containing the…
-
0
votes1
answer57
viewsHow to prevent my java application from opening twice or more simultaneously?
I am developing a project, in which I need to prevent the user to run the application more than once at the same time, that is, if the application is already running instead of running again it…
-
0
votes1
answer1135
viewsWhat is Static in Java? And How to use it?
How can I use the Static in Java? and what is it for? What is its function?
-
0
votes2
answers667
viewsGo back to another Activity and pass parameters
I’m having a problem adding items to a ListView, have a activity main calling another to add the met package com.example.jonathan.agendaonline; import android.content.Intent; import…
-
0
votes1
answer95
viewsIn Java, getter and abstract Setter is correct?
I have an abstract parent class Usuario. And a daughter class Usuario_Adulto. The attribute idade is in the abstract class Usuario. To validate it I made a method Setter abstract in the parent…
java inheritance polymorphism abstract-classesasked 4 years, 2 months ago MARCOS DAVID ALMEIDA DE SOUSA 3 -
0
votes1
answer772
viewsMerge database with java application
Hello, I did a college job using java screens using the ide netbeans, crud the database ,using postgresql as the main database, I was able to finish and everything, however I would like to send only…
-
0
votes1
answer149
viewsInjected object but is null
I have an object that is injected into my converter : package br.com.pokemax.modelo.converter; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import…
-
0
votes1
answer80
viewsConvert query return to Integer
How can I cast a query for Integer? Follow what I tried to execute. public Integer validaPrincipal(String usuario, Integer tipo) { try{ return (Integer)…
-
0
votes1
answer40
viewshttpurlconnection on android:
Hello, I’m trying to get the http response code, and I’m using this code : HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("GET");…
-
0
votes2
answers1284
viewsHow to check if a character is letter or number?
System.out.print("Frase: "); String frase = sc.nextLine(); // Exemplo: a1b2c3d4 for (int i = 0; i < frase.length; i++) { if (frase.chatAt(i)...........// Qual método ou lógica que verifique se…
-
0
votes2
answers96
viewsChange language in the app and stay changed
I have an app and I would like the user himself to change if you want Following this link even worked, but if I clear the cache of the mobile phone (I think that’s it) or clean all open screens and…
-
0
votes1
answer60
viewsHow to read keyboard data to an array in Java?
I’m trying to pass the data inside the matrix, but it’s not running the lines. int i=0; int j=0; for(;i<3;i++){ for(;j<4;j++){ System.out.println("Valor para a posição ["+i+","+j+"]");…
-
0
votes1
answer104
viewsStructure Package Intellij
Good afternoon, you guys. I’m new to Intellij, I’m still getting used to it, however, I’d like to know if there’s any way to change this file display structure in the package. Follows the structure:…
-
0
votes0
answers68
viewsHow to edit an entity that has another jsf object?
Good afternoon guys, I’m new to programming and I’m having problems with my jsf project. I have a client class that has an address object, with relationship @OneToOne to the address. I am able to…
-
0
votes1
answer91
viewsEnum me returning null Pointer
My Enum is returning Null Pointer when re-running this call: System.out.println(DefinicaoSCM.getDefinicaoSCMPorDisciplina(Disciplina.IMPLEMENTACAO)); Implementation: public enum DefinicaoSCM {…
-
0
votes0
answers58
viewsJAVA Sqlserverexception: The index is out of range
Good morning, I’m new to JAVA and I’m having trouble maintaining a legacy system... I use the Eclipse IDE and in it the code is OK, without criticism. I’m reading a form on a web system, picking up…
-
0
votes3
answers53
viewsException in thread "main" error in Netbeans
I was making code in Netbeans: calculator package; public class Calculator { public static void main(String[] args) { int x = Integer.parseInt(args[1]); int y = Integer.parseInt(args [2]); sum(x,…
javaasked 4 years, 1 month ago Israel Messias 1 -
0
votes1
answer356
viewsHow to validate jcomboBox before saving
I have the following problem, I am trying to validate these jcombobox, I want that if the user does not select an item from the movie jcombobox, a message appears: "Select Movie", if it is the…
-
0
votes1
answer32
viewsError searching in Database
My application is integrated to my bank and makes several queries, but in one of them something unexpected is happening, because the search is not performed. Note that my instruction line is simple…
-
0
votes1
answer34
viewsFor some reason, when I type in the answer, nothing happens, whoever can help me fix that code, I thank you
For some reason, when I type in the answer, nothing happens, anyone who can help me to fix it, I thank you import java.util.Scanner; public class Main { public static void main(String[] args){…
-
0
votes1
answer59
viewsIs CQRS login in Command or Query?
Hello, I will do Login in hand (would not use Identity or any other lib or service) I am using CQRS, I wonder if I should put the Login as Command or as Query, given that there will only be a logic…
-
0
votes1
answer85
viewsProblem reading strings and numbers in sequence with Scanner
I came across this problem in the code at the time the program will read the second name and the second name note, ie the name of the second student and his grade. Can you explain to me what…
-
0
votes1
answer65
viewsInjection of dependencies failure
I am new to the world of Hibernate and when I run this application, I get the following exception (error refers to persist EntityManager): java.lang.NullPointerException Caused by:…
-
0
votes1
answer21
viewsWhere to put new packages in a Maven project in eclipse?
I am learning to use JPA with Maven in Eclipse, and I intend to use the MVC design pattern, when I create the project, I have the following vision: Well, I wanted to know in which folder I should…
-
0
votes1
answer37
viewsWhat are the advantages of using Jenkins to run processes in the background?
I’m having contact with a web system where they use Jenkins to execute processes in the background, in this case, queries to generate reports. The user makes the request and the processing is done…
-
0
votes0
answers17
viewsUsing an Azure devops feed to be able to consume artifacts from it in a Scala sbt Java project
I would like to know how to consume articafts from an Azure devops Maven project feed in a Scala SBT application. I’ve done a lot of research, but I can’t find an answer. We can open a discussion to…
-
0
votes1
answer76
viewsProblem with vector position
I have an application in which I made an image arrylist, which in this image list has its position, in the method onBindViewHolder @Override public void onBindViewHolder(MyAdapter.ViewHolder holder,…
-
0
votes0
answers32
viewsWhat is OVERLOAD for?
Guys, I’m starting to do a crud that my teacher asked for in college. He passed a pdf and good, I had absolutely never heard of this concept. I’m using java and he used Connectionfactory with…
-
0
votes0
answers80
viewsProblems to the popular Tableview
Good morning! When I run the code my Tableview pulls 2 blank lines. I am not able to show the inforamations in table view. Follow code below: Controller: package br.com.unitymanager.controller;…
-
0
votes1
answer566
viewsHow to write about an image
I found this code on the Internet and made some changes, but I’m not sure what’s going wrong. Code: public class main { public static void main(String[] args) throws IOException { String key =…
-
0
votes1
answer42
viewsDrive error of player
Hello! I’m trying to make the player walk but always when I press a button appears huge error I’m trying to make the player walk but this error appears Exception in thread "AWT-EventQueue-0"…
-
0
votes2
answers65
viewsCheck if there is a specific value within a java bi-dimensional array
I need to check if there is a specific value in case the value 1 within a bi-dimensional array for the code return if a value is true or false. The code I used was the following : for (int i = 0; i…
-
0
votes0
answers64
viewsProblem with JSF & JPA Lists
I don’t know if it’s right the way I’m doing it, but I got a problem: java.lang.Illegalargumentexception: id to load is required for loading. When I try to remove a template from the list, and also…
-
0
votes0
answers284
viewsSend a JSON + Multipartfile to an endpoint. Spring Boot
Hey, guys, all right? I’m doing a project and I got stuck in a certain part. Summarizing what needs to be done: I need to create an endpoint that receives a JSON from a Person object (Name, Password…