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
votes1
answer215
viewsIs it possible to return the values of a Resultset?
Next, I would like to: if the book is already "borrowed" in the bank, to show to those who borrowed it, and if not, allow the loan. With this, if this loan already existed, I would like to return…
javaasked 6 years, 3 months ago Weslley Fillipe 161 -
1
votes1
answer124
viewsreverseOrder() In java not reversing
I have a method in java to sort a vector in a decreasing method, but when I run the test it returns me the unpaired vector. Follows the Method: public void sort() { int vet[] = this.vetor;…
-
1
votes3
answers443
viewsGet Integer value in final . 00 and float value in . 01 to 0.9
I have this code below that is a calculator, but I have a problem: I wanted to return a value float when dividing 5 / 2 = 2.5 and returning an integer value when dividing 4 / 2 = 2 and not 2.0! Can…
-
1
votes1
answer252
viewsJava - What to do when JSON can come in Double and Long?
I am using a Climatempo API. When I get the weather data of a city via JSON I get the temperature as follows: clima.setTemperatura((Long) dataNode.get("temperature")) However, in the API…
-
1
votes1
answer79
viewsJava: Problems using lambda expressions in generic Listing method
The problem would be that I cannot multiply the variables that return from Listing using lambda (e*e), it keeps asking to create a Listing method using Object, but using Generics. I appreciate any…
-
1
votes0
answers99
viewsPut sound in app notifications
I’m having trouble with my application, I’m trying to send notifications to mobile devices, notifications arrive but they do not present sound and I need them to make the sound to draw attention. I…
-
1
votes1
answer89
viewsHow to return an avinda list of the database using Asynctask, and then deliver it to the class that will manipulate it?
I have an Internet class that loads a list from the database, but on the return of the doInBackground it returns the empty list. I already tested and the for is getting it right, then populates the…
-
1
votes1
answer112
viewsHow to remove add/remove dashboard as you select from checkbox?
I’m adding a panel at the bottom of a JFrame, when a checkbox this selected, and when I uncheck it, remove the panel, and leave only the checkbox, however, I’m not getting, I think the layout…
-
1
votes1
answer4788
viewsDistance between two points
Read the four values corresponding to the axes x and y of any two points in the plan p1(x1,y1) and p2(x2,y2) and calculate the distance between them, showing 4 decimal places after the comma,…
-
1
votes1
answer199
viewsHow to read a json using Gson when the class contains Arraylist’s in JAVA
Hi, I’m doing some college work and I’m having trouble faking a persistence. The idea is this, I have an Observable/Singleton class that does both the control of updating data from some lists and…
javaasked 6 years, 3 months ago LeandroLuk 4,989 -
1
votes1
answer50
viewsHow to make a for in a script tag?
Guys, I’m trying to create a page on my site that shows me title, description and the location of the record of some occurrences. When I access the page, I load through a <c:forEach> all…
-
1
votes1
answer3765
viewsError while running default springboot project
I am trying to run the default springboot project that I acquired here. The project has the following dependencies: <groupId>br.com.fc</groupId> <artifactId>api</artifactId>…
-
1
votes1
answer387
viewsQuery with JPA filtering by Entity List
I’m performing a system in Java using Springboot and JPA, being event management and have two entities: Inscricao and HorarioAtividade. They have a relationship Many To Many, with my class Inscricao…
-
1
votes1
answer554
viewsData structure - arithmetic expressions
I recently received the following challenge in college, but I’m having a hard time The challenge is: Identify how a subset of numbers from 1 to 1000 can be written using arithmetic expressions that…
-
1
votes0
answers255
viewsREST requests with HTTPS
Good morning, everyone, One can make a doubt... is the following: I have an application that is within a certified domain (HTTPS). When I consume a REST service, I get 405 return and in the browser…
-
1
votes1
answer530
viewsPaging springBoot
I’m new to Spring and web development and I’m having problems paging a select, this is the method that makes the search: public static Page getAllPeople(Connection connection, Pageable pageable) {…
-
1
votes2
answers418
viewsSpring - @Autowire a List with elements
I have a controller that has this @Autowired: @Autowired Rules rules; This Rules class is defined as follows:: @Service public class Rules { @Autowired private List<RegistrationRule> allRules;…
-
1
votes0
answers31
viewsMysql and Jaspersoft
I need to generate a dynamic report through Jaspersoft, the result of consulting three Mysql tables. The tables are: CREATE TABLE IF NOT EXISTS `tcc`.`Catalogo` ( `idCatalogo` INT NOT NULL, `titulo`…
-
1
votes1
answer333
viewsThe Operator + is Undefined for the argument type(s) Charsequence, int
I’m trying to concatenate a text into CharSequence with int, but java warns that it is not possible to do this conversion by saying: The Operator + is Undefined for the argument type(s)…
-
1
votes1
answer1541
viewsHow to open an Activity via a button
I’m having a problem opening my Activity on various forums and I haven’t found the answer. I have the Activity "Teladelogin" and the Activity "Feed", and I have tried to open in various ways, here…
-
1
votes0
answers30
viewsProgram type already present: android.support.v4.util.Timeutils
buildscript { repositories { jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:3.1.3' } } apply plugin: 'com.android.application' dependencies { implementation…
-
1
votes1
answer217
viewsCount repetitions of TAG in XML file
Example of XML file: <rec> <v001>001</v001> <v002>2012609272311</v002> <v003>616.890231</v003> <v005>7</v005> <v006>m</v006>…
-
1
votes2
answers592
viewsSpring Modelling JPA Person -> Personal Modelling -> Function
I did the data modeling (UML) but at the time of implementing I’m doubtful how to do. I wish there was only one table Person. In that table person I would have the field tipoPessoa("p","f") and…
-
1
votes1
answer24
viewsHow to restrict that some folders are displayed in the gallery? android
I know how to list all the gallery photos but I need the Download folder not to appear in the list. I know I can filter but I can’t make it work. I do not parameter in the query I must paste so that…
-
1
votes0
answers201
viewsNo Qualifying bean of type [br.com.spring.JPA.Service.Postservice] found for dependency
Can someone help me with this mistake? No qualifying bean of type [br.com.spring.JPA.Service.PostService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for…
-
1
votes1
answer39
viewsAppend lines in an existing file
I’m trying to add lines to a report, but the new lines are overwriting the old ones. Class with main method: import java.io.FileNotFoundException; public class TesteInscricoes { public static void…
-
1
votes1
answer62
viewsWhat code do I use to create a Validate class on Androidstudio?
I want to create a class to check the 2 fields EditText are filled, called Validacao. I wanted to call like: if (Validacao(TextoA, TextoB) == true) { executa código; I don’t know what the class code…
-
1
votes1
answer214
viewsError opening a new Activity on mobile - Android Studio
Good morning, everyone!! So, I’m new in programming for Android, it turns out I created 3 screens: Leading Categories Attitude The main one is only for it to go either in Categories or Exit. The…
-
1
votes1
answer264
viewsError Performing load command : org.hibernate.Objectnotfoundexception: No Row with the Given Identifier exists
Good afternoon! Loading a list from the Archive entity: org.hibernate.event.internal.DefaultLoadEventListener doOnLoad INFO: HHH000327: Error performing load command :…
-
1
votes1
answer371
viewsDoubt in Toast.makeText(this, ...)
This is the same code as a previous doubt, but now my question is another. In the Toast.makeTest(this, msg, Toast.LENGTH_SHORT); gives the following error when compiling, I believe that because of…
-
1
votes1
answer29
viewsLog activity for synchronization capturing task data running in background
I develop an application in Cordova, which synchronizes with an online database, the synchronization part is all in Java. (Context of the app) I am developing a "Log" screen for the synchronization…
-
1
votes1
answer90
viewsGenerate constant tags using Xstream in Java
Hello I need to generate an xml with uppercase tags that would necessarily have to be final attributes in the model class to generate xml. To do this, I’m trying to use the Java Xstream API. However…
-
1
votes1
answer352
viewsLimit an Edittext from 1 to 100 and include the "%" symbol
I’m making an application that takes the data entered in a EditText and makes a certain calculation. The problem is that I need the field to go from 1 to 100%, but the "Mask" I’m using is too simple…
-
1
votes1
answer93
viewsHibernate no Excludes
Good night, you guys... I’m learning hibernate and I had a problem: I was able to insert, retrieve the BD data... I had a setback that I fixed by adding the following command line in the execution…
-
1
votes2
answers69
viewsSearch is not performed after connecting to the Java database
I’m trying to run a database search using java code, but I can’t. The database is connected, but the search is not performed. I created two classes, one that has the class with the connection…
-
1
votes1
answer279
viewsHow to change Apptheme?
I have 2 Styles files. With a click on a button I want to change from Apptheme to Apptheme2. how to do? Manifest.xml <application android:allowBackup="true" android:icon="@mipmap/ic_launcher"…
-
1
votes0
answers52
viewsTabllayout in a Fragment occupying all space
Good afternoon. I want to make an app where I have a side menu, with default options, like "home page, profile, about etc...". When I click on the home page, I want my screen to turn into a…
-
1
votes0
answers77
viewsHow to delete a photo from the gallery on Android
I have a code where I’m using my camera to take a picture, then I put it in a Imageview, only for viewing as it is saved then in my Sqlite. I wonder, how do I delete this photo from the gallery,…
-
1
votes1
answer91
viewsHow to use Localdate in Vraptor4?
I am trying to make a simple application in Vraptor 4. In an Entity, I have two attributes, one of the kind LocalDate and another of the kind LocalTime. I added the Vraptor Java 8 plugin, which…
-
1
votes0
answers22
viewsHow to increment tailSet integers in Treeset<Atomicinteger> without addAll()?
I have the following part of a class: private TreeSet<AtomicInteger> offsets; // ... public void addIndex(int index) { SortedSet<AtomicInteger> set = offsets.tailSet(new…
-
1
votes0
answers137
viewsProblem with Gradle Android Studio
I’m getting a Gradle Warning to exchange Compile for the implementation and api, but I’m no longer using Compile in my project. Configuration 'compile' is obsolete and has been replaced with…
-
1
votes4
answers141
viewsIs there performance gain using . replace() instead of . put() in a Map?
Is there any performance gain using the method .replace() instead of using .put() in a Map. Studying Maps I noticed that the method .put() and .replace() have practically the same function. I made a…
-
1
votes0
answers64
viewsHow do I perform/work the call through the AJAX url?
To put it in context: There is a remote directory, clearing-dit\logs, which has a number of logs (portal.log, test.log, ...). This directory, is mapped to an HTML page, where all of its .log's are…
-
1
votes1
answer75
viewsGet values from the 4th Firebase node on Android
I need to fetch the red highlighted values in the image, but I only know the blue highlighted item. I tried that way: firebase =…
-
1
votes0
answers2231
viewsError: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
I am trying to consume data from an API using retrofit, but whenever I try to connect it returns this error. I’m using a class that is an Array of these objects (Sisalfacatalog) and throwing the…
-
1
votes0
answers73
viewsJava - Anamorphism (image manipulation)
Good evening, I’m creating an application for a specific goal, which manipulates image, I’m using methods such as: image.BufferedImage Graphics2D RenderingHints In this context I’m taking a specific…
-
1
votes1
answer987
viewsGrab each row of a CSV file
I need to take data from a CSV file and store it in an array. Example: CAIO ; 0909;abacaxi BRUNO;1231;maça I have to take for example row 1, and each value of each column store in a variable to play…
-
1
votes2
answers882
viewsDoubt about filling in Java Array
I’m having trouble solving the following exercise: Create a class with a main method; Create an int array with 10 positions and popule using for; Print all array values and, for even values, display…
-
1
votes0
answers35
viewsIs it possible to assign the same URL to more than one controller?
I’m trying to use AJAX $.ajax({ url : urlN, // <<- "/log" type: "post", success : function(json) { console.log(json); document.getElementById('content').innerHTML = json; }…
-
1
votes0
answers54
viewsError calling non Static function from a static context
I created a class only to call 2 methods that cannot be static. But when calling the method of this object returns the error that I am not able to interpret. Code: public static Handler handler =…