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
-
-3
votes2
answers6070
viewsConvert Jtextfield to integer and save to bd
I have a JTextField which is populated from the database as text, would like to save in another BD as int. Could someone please help me? My code: String sql = "INSERT INTO ass_cidade(id_cidade)…
-
-3
votes1
answer108
viewsProblem with programming logic in Java
Good afternoon to all, started two weeks ago a sequence of studies on programming for Android. I am studying by this book http://novatec.com.br/livros/googleand/sumario9788575221860.pdf bought it a…
-
-3
votes1
answer36
viewsMy button does not work when I put f:validateRegex
Without f:validateRegex the button works normally, but after you put f:validateRegex to validate the input data, it doesn’t work anymore, someone can help? Follow the code attached, I can’t format…
-
-3
votes1
answer38
viewsJava Mysql and FTP connection
My doubt is not about how to make a connection with ftp or mysql, because this is not getting. I connect using parameters such as host, port, user and password. My source code stores this…
-
-3
votes3
answers149
viewsCheck two denials in an if expression
I’m putting this on: if(!teste.trim().equals("") || (!(teste == null))){ // ...faz algo sem NullPointerException... } But the second clause is not working, the one that tests if it is not null. I…
-
-3
votes1
answer2816
viewsWhere can I find simple code examples made entirely in Java?
Where can I find simple code examples made entirely in Java? I need links!
javaasked 10 years, 1 month ago Danilo Silva 307 -
-3
votes1
answer650
viewsWhy does this method generate java.lang.Stackoverflowerror?
The following code generates this: java.lang.StackOverflowError at modelo.Secao.eleitores(Secao.java:67) And I don’t know why.…
-
-3
votes2
answers82
views -
-3
votes3
answers210
viewsHow would I look regex to handle this case?
I’m not able to separate words this way: In case I have CPFConsole, wanted to separate to cpf and console. The code I have separates so: ([A-Z][a-z]+)|([a-z]{0,})|([A-Z]{2,}) But that code separates…
-
-3
votes1
answer183
viewsJava Trigger Return
I have a Rigger that checks if the user login has more than 3 characters and if it does not have it returns the msg "login must have more than 3 characters", how can I capture this return in java…
-
-3
votes1
answer56
viewsHow to change Padding or margin of homeasupindicator
How to take the space between arrow and icone android?…
-
-3
votes1
answer66
viewsRotation over a point on a 2D pivot in Java
I’m trying to figure out how to rotate a vector over a point (another vector) as a PIVOT tried on some websites that gave me the following code: public Vector2 rotate_point(float cx,float cy,float…
-
-3
votes1
answer524
viewsSort String List
Does anyone know how to sort a list (Array List)of Strings containing alphanumeric information of the type: "ABC 12" "A 8"
-
-3
votes1
answer133
viewsError: Exception in thread "main" - Stackoverflowerror
I created a library CRUD, but when I installed the class Biblioteca in the main, and was running occurred this giant error: Class Cadastrar: package Operacoes; import…
javaasked 9 years, 3 months ago italo vinicius 59 -
-3
votes1
answer34
viewsEnterprise services in the cloud
The "breakthrough" of cloud services technology will lead to Webservices in the cloud rather than a private network of enterprise X or even local network?
-
-3
votes1
answer76
viewsObject null, I don’t understand why
I have this myDB object which is an object of the Databasehelper class, but when I try to invoke a method of that class it says that that object is null. Class where this object: public class…
-
-3
votes1
answer186
viewsNullpointerexception - Genetic Algorithm
package chapter2; public class AllOnesGA { public static void main(String[] args) { //Cria instância da classe "GeneticAlgorithm" GeneticAlgorithm ga = new GeneticAlgorithm(100, 0.01, 0.95, 0);…
-
-3
votes1
answer62
viewsJava "per unit" logic
How can it be a method to return the following: Knowing that 220 is equivalent to 0.3275 and that with each addition of 0.0049 in the value of 0.3275, it will increase in one unit the 220, or with…
-
-3
votes1
answer72
viewsCheck if the user has balance/credit
I am making an app in which I need to check if the person has credit on the mobile. I was wondering how can I do it. Mt thank you
-
-3
votes1
answer76
viewsCan someone give me a sense of how I do
Model computationally the representation of the functioning of a lamp, where it is possible to light, erase and check whether the lamp is access. I did this: class Lampada { boolean aceso = true;…
-
-3
votes2
answers464
viewsHow to get HTML code from a protected page with Cloudflare?
I’m trying to get the HTML of a page with the Jsoup. This page has Cloudflare as protection and, instead of getting the HTML code of the site I’m interested in, it’s returning me the HTML of the…
-
-3
votes2
answers286
viewsHow to avoid memory bursting with recursiveness
I have a function that is called recursively, how to avoid memory bursting ?? int cont = 0; public void recur() { recur(); cont ++; System.out.println("Chamado: " + cont); }…
javaasked 8 years, 12 months ago Lucas Caresia 2,663 -
-3
votes1
answer43
viewsProblem with do while
public static void main(String[] args) { Scanner sc = new Scanner(System.in); BancoConta p1 = new BancoConta(); p1.inicio(); } public void inicio() { do { System.out.println("Para criar conta…
-
-3
votes2
answers6416
viewsCheck if the string contains only numbers
How can I check if a string contains only numbers? For example, you can’t have * / = e etc... only numbers. Because I need to convert a string to int and if you type letters, symbols will generate…
javaasked 8 years, 9 months ago user92401 -
-3
votes1
answer356
viewsScroll between two dates
I have two dates in milliseconds. I need to recover every day of that period to make an insert in the database. I thought I’d do one for each day of that period, but I have no idea how to do it!…
-
-3
votes1
answer88
viewsmain(String[]) exceeds 65535 bytes limit
Hello. I need to execute the code below with values that exceed those allowed by the main string, what I do? It is a list of numbers exceeding 65535 characters. in reality the program will be used…
-
-3
votes1
answer157
viewscould not open terminal for stdout
I am having a problem with Gradle when executing any command is returned to me the following error message: * What went wrong: Could not open terminal for stdout: could not get termcap entry Preview…
-
-3
votes1
answer71
viewsGet Object id[]
I need to get the id of these objects. Object[] classe = getNames().toArray(); String[] strings = Arrays.stream(classe ).map(Object::toString). toArray(String[]::new); for (int…
-
-3
votes2
answers261
viewsHelp in Java: Arrays
Exercise: Make two lists of names in the form of arrays, compare how many names on List 1 are on List 2, and then calculate the percentage of these, about the percentage of total people on List 2.…
-
-3
votes1
answer1059
viewsError: Unable to locate or load Olamundo main class.java
I’m trying to compile and run a "hello world" in Java from the command line. My code is: public class OlaMundo{ public static void main(String[] args){ System.out.println("Oi , funcionou"); } } I’m…
-
-3
votes2
answers152
viewsWhen do I use.metodo(). metodo()?
Good night. I have one question: when I use a syntax like: metodo(). metodo()? When and how I use this method?
javaasked 8 years, 2 months ago Fernando Costa Leite 15 -
-3
votes1
answer178
viewsHow many classes can we have in one package?
How many classes can we have in a single package?…
-
-3
votes1
answer46
viewsIt is allowed to perform the operation module % with double number in java, and how to change a single position of a string in java?
My doubts.. It is allowed to perform the operation module % with floating point number in java, and why? Because in compilers like c++ this operation is not allowed. How do I access an element of a…
javaasked 8 years, 2 months ago Victor OCV 393 -
-3
votes1
answer151
viewsError testing Cielo sandbox
When accessing the urls https://apiquerysandbox.cieloecommerce.cielo.com.br/1/sales/{Paymentid} when replacing Paymentid with a value: 1 (random value) I get this message: "Message": "The requested…
-
-3
votes1
answer250
viewsUpdate system in Java Web
Good afternoon, everyone, I have the idea of making a system with Java Web, but I’m starting to learn java now. A friend told me about doing with Java Web and told me to do in Python. The arguments…
-
-3
votes1
answer54
viewsHow do I run my code asynchronously and in real time or with each given time span?
I need to know how to run this code on my server, asynchronously and in real time, or every 5 minutes, for example. String asB64 =…
-
-3
votes1
answer67
viewsjavax.naming.Noinitialcontextexception:
I am trying to do a university job with messageria, but my chat is not starting and presenting the following problem: javax.naming.NoInitialContextException: Cannot instantiate class:…
-
-3
votes2
answers366
viewsWhat’s wrong with my code? I’m a beginner
I want to create an employee class with the specifications below, but I cannot return the show data method and the method calculate salary. It gives compilation errors when calling the methods, I…
javaasked 10 years, 1 month ago Thiago Marques 77 -
-3
votes1
answer195
viewsCall a new screen using a button (Scene Builder, Javafx)
I created two screens, one main and one that I intend to call using a button, as it would be the appropriate method to call this secondary screen?
-
-3
votes1
answer200
viewsReserved word as variable name
I’m building a program that integrates an online store with another program that controls the physical stock of a store. Communication is done through HTTP requests that respond in JSON format. In…
-
-3
votes1
answer36
viewsis it advisable to make java programs just by creating new classes within a single eclipse project?
I started studying the Java language recently and I have a question, it is better to create a new project or always create a new class within a single project even if it is not about the related…
javaasked 7 years, 10 months ago MARCELOHENRIQUE 1 -
-3
votes2
answers1334
viewsWhat is the difference between Double and Double in java?
I was making a code and, by mistake, I put double and the IDE accepted, I always used with the D capital. What’s the difference between the two?
-
-3
votes1
answer128
viewsFailed to add Class objects to the Array List
I have the class below: package carcleo.com.radiosingular.classes; import android.util.Log; import android.widget.Toast; import com.google.gson.JsonArray; import org.json.JSONArray; import…
-
-3
votes1
answer57
viewsWhy is the image I painted on the canvas disappearing?
package Principal; import java.awt.Canvas; import java.awt.Color; import java.awt.Graphics; public class Desenho { public static void main(String[]…
-
-3
votes1
answer100
viewsNo Persistence Provider for Entitymanager named x
This my project does not recognize my Persistence Provider. It follows the same below. Your location plus dependencies: I’m calling the same through a very simple XHTML using a Managebean. Below…
-
-3
votes1
answer87
viewsJava Interactions
Good morning to all dear programmers. I’m recently starting the JAVA language, I wonder if it is possible to perform as in javascript user interactivity with the software. Like an Hover that blurs…
javaasked 7 years, 7 months ago Raul Cesar 86 -
-3
votes4
answers623
viewsPrint ranges of numbers with final 5
I’m trying to print the numbers from 0 to 200 that have only the number 5 as the last digit. package Exercícios; public class NumerosQueComeçamComAlgarimo5 { public static void main (String [] args)…
-
-3
votes2
answers252
viewsPower with For or While
I need a little help, how do I calculate the power using the for or while, I don’t want to use the Math.Pow function()
-
-3
votes1
answer66
viewsDOUBT OF INHERITANCE IN JAVA(SMALL)
You were hired to develop a system for a motorcycle workshop, cars and trucks. Your first task will be to build a set of classes for represent the vehicles that will be met in the workshop. having…
-
-3
votes1
answer87
viewsOCA Java 8 certification, does it exist in Portuguese? Where should I pay for the test and at what institution?
Good afternoon my comrades. I am interested in making the JAVA 8, OCA certification test, only I do not speak English, there is proof in Portuguese, if there is where I must pay and in which RJ…