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
answer1147
viewsDelete data from Sqlite database
I’m making a database program. I wish I had the option to delete a data from database Sqlite. So here’s what I did: In my OpenHelper called the following method: public void delete (){…
-
1
votes1
answer72
viewsRegular expressions do not match the desired text snippet
I’m needing my program to capture an item from a given text, but it’s not doing that, on the contrary, it’s capturing everything that comes after that. Code I’m using, ex: String html =…
-
1
votes1
answer269
views3 new user post questions with spring boot
am having the following questions when saving a user in an api using spring boot. 1)The best way to check if the email already exists is this? 2)in case I am sending the id of the user that has just…
-
1
votes1
answer138
viewsNullpointerexception error in running my program
I am doing an activity with the following statement: You must implement a digital clock in Java. For this, you create three classes, namely: Counter, Clock and other class to test the execution…
-
1
votes1
answer143
viewsCaptures what the user types and writes to a . TXT
I made a little program in Jframe, basically it captures what the user types and writes to a txt, but when I see the contents of the file is written, the following "null". What might be going on?…
-
1
votes3
answers110
viewsHow to call the same method with different arguments but inherited from the same mother class?
I have two classes (ColunaDoGrafico and ColunaDoRelatorio) extending from Coluna. My Column class has the following structure: public class Coluna { protected String tipoFiltro; protected boolean…
-
1
votes1
answer423
viewsDynamic printing Jasperreports
I’m trying to make an impression with JasperReports, when compiling the report I get the following error: Exception in thread "main" net.sf.jasperreports.engine.design.Jrvalidationexception: Report…
-
1
votes1
answer346
viewsJoin fetch multiple returning duplicate values JPA Criteria API
In the method in question I want to return the consultation with the joins of employee and company. However, the Company class is related to the Query and the Employee, and is returning duplicate in…
-
1
votes1
answer132
viewsTest APK Dependency Conflicts
In an old application I was updating the version of the dependencies of Gradle, when running I received the following message regarding a conflict between the version of the dependency…
-
1
votes1
answer26
viewsReport always prints in A4 format
I am creating the entire report at runtime, however, at the time of printing it is not respecting the size I set. No ReportViewer it displays right, but in the printer or on PrimoPDF does not print…
-
1
votes1
answer197
viewsError Access Restriction: The type is not accessible
I’m trying to develop a simple java screen using JFrame but in my eclipse is showing a message on JFrame. Access Restriction: The Construction Jframe(String) is not accessible due to Restriction on…
javaasked 6 years, 6 months ago adventistaam 3,354 -
1
votes1
answer459
viewsProperly manage database connections using Hibernate
What would be the best standard for connections, I thought of two modes : Mode 1 : Each function creates and closes its own connection Insert function' EntityManagerFactory factory =…
-
1
votes1
answer224
viewsView Jtable on multiple panels
How do I make mine JTable is displayed on all tabs inside the panels? I’m only able to display in the "Day 5 tab". import java.awt.Container; import java.sql.ResultSet; import…
-
1
votes1
answer906
viewsPassing variable value obtained in one method to another method in Java
The project is a school GED, where there is the main class that makes the connection to database and there is another class to generate PDF files. The issue is that the system comes to extract the…
-
1
votes2
answers118
viewsReceive 3 random values and allocate in 3 variables from smallest to largest
I need to write a program that receives 3 random values and allocate the 3 values in 3 MINOR, INTERMEDIATE and MAJOR variables. I tried something like this, but when printing the values, I get the…
-
1
votes2
answers870
viewsHow to use a file . JSP
I am extremely new in JSP language, I wanted to know how to use a jsp file that I created and display for example in the browser, the same way I do with html files, ie how to use a jsp file…
-
1
votes2
answers2495
viewsFirebase Cloud Messaging (FCM) - Push Notification (Java)
I am working on a backend that I would like to use to send / Push notifications to android app using the Firebase Cloud Messaging (FCM). I’ve read the documentation a few times (WCF) but I still…
-
1
votes1
answer1206
viewsTextfield Javafx with dynamic monetary value mask
I’m trying to create a textfield java FX for a financial application. I would like this texfield to follow the same pattern of numerical fields found in bank Atms. For example : in ATM the initial…
-
1
votes2
answers218
viewsHow to break an infinite loop using Ctrl-C in Java
I have a multithreaded server that sits in an infinite loop waiting for new connections and I want to be able to stop this loop when I press Ctrl-C (or something similar). I tried to use that one…
javaasked 6 years, 6 months ago Michael Pacheco 1,657 -
1
votes1
answer1495
viewsRemove() method does not remove Arraylist object
I’m having a doubt to remove an object from a list on a job. I have a car class: public class Automovel { String marca; String modelo; String preco; Automovel(String marca, String modelo, String…
-
1
votes1
answer122
viewsHow to have an Arraylist by composition
I understand how to compose but I’ve never done with lists, although the principle should be the same, I don’t understand how to do. For starters I have a class CentroComercial who owns a ArrayList…
-
1
votes1
answer508
viewsJAVA POO - How to call a function from a Class
So I have the following problem , I created a 30x60 matrix in which I will generate a number in a random position, so far so good. But when I took the function that generates the number and put it…
-
1
votes1
answer38
viewsError trying to open map with path disabled
So far, the goal of this application is, when opening, locate the user and display some points already mapped. When the app opens (location disabled or not), it asks if the user allows him to use…
-
1
votes1
answer282
viewsNullpointerexception when using setText for a Textview in Fragment
I am creating a Fragment where I have in one part the map and in another an object of Retrofit, where I get date and time from a server. The error occurs inside the Retrofit onResponse call, where I…
-
1
votes1
answer150
viewsDetect overlay of figures after dragging with the mouse
I drew four figures with Graphics 2D (two large and two medium triangles), being two fixed (1 medium triangle and 1 large triangle) and 2 for movement (1 medium triangle and 1 large triangle). When…
-
1
votes1
answer1794
viewsSpring Framework Error: Unable to locate or load main class
I’m following some lessons from a Spring workshop, but I can’t go on because of the mistake: Unable to locate or load main class. Below is the code containing the main function: package…
-
1
votes1
answer978
viewsMap json using Jackson
I have a question on how to map a json to a model, I really have no idea which way to go, I saw some material on the internet, but what I really lack is to really understand how this works there in…
-
1
votes1
answer89
viewsAutofocus in Edittext does not work
I have a EditText that always needs to be in focus, and a Button whichever: <EditText android:id="@+id/edtCod" android:layout_width="match_parent" android:layout_height="wrap_content"…
-
1
votes2
answers165
viewsCalling the method of a specific superclass
Suppose I have the following hierarchical structure in Java: First a class Avo: public class Avo { protected String nome; public void falar() { //Codigo aqui } } Next I have a class Pai who inherits…
-
1
votes1
answer144
viewsInfinite loop with an if inside a do in Java
Good evening. I’m doing a college job on an ATM and I’m having a little doubt. I’m creating a do to make the ATM repeat menu, but before the user enters the box, it will set a value for the…
-
1
votes0
answers122
viewsHow to use spring security isEnabled
I was wondering if I am using the isEnabled spring security method correctly. Because on my system, every user has a list of profiles. If admin removes all their profiles and the user tries to log…
-
1
votes1
answer167
viewsJPQL Not recognizing the parameter
I need to perform a query using JPQL or Spring-data keyword method. The problem is that the parameter inserted in the query is being ignored, I still could not identify the cause of it. Since the…
-
1
votes0
answers52
viewsProblem Accentuation
Friends, I have a problem, all the accents you have in the program that I made using Tomcat are with "?" as an example: Atrav? s, informs?? es,? ndices. in the pom I set up: <properties>…
-
1
votes1
answer136
viewsWildfly server
Standalone of the wildfly <interfaces> <interface name="management"> <inet-address value="${jboss.bind.address.management:127.0.0.1}"/> </interface> <interface…
-
1
votes2
answers517
viewsUnderstanding the use of Generics in an abstract DAO Hibernate class
Hello, I am starting to develop a web application with spring+Hibernate framework, I started for an example that contained following class: import org.hibernate.Criteria; import…
-
1
votes1
answer138
viewsHow to determine the level of access of the elements of a class?
This is a question of the Secitec 2018 competition for the position of computer teacher. I appealed to this question because there are no qualifiers, but access modifiers such as: private, protected…
-
1
votes1
answer565
viewsHow to pass parameters from one Fragment to another Fragment in the same Framelayout?
I have a main Activity that has A frameLayout. FrameLayout starts with Fragment. Fragmenta has a button that calls Fragmentb opening in the same frameLayout, replacing Fragmenta. How to pass…
-
1
votes1
answer170
viewsHow to override equals for it to compare: primitive objects and keys (int, String, double)
Is there any way to compare? because in my code, if it is not int or Object the program throws an exception. To be able to use in the method contains the Listsequential class. Classe Pessoa public…
-
1
votes1
answer313
viewsMap relationship between tables without Foreign key
I have two tables in postgresql: schema1.immobile idt_imovel | int cod_imovel | string nome_imovel | string etc... schema2.declaration idt_declaracao | int cod_imovel | string status | string etc...…
-
1
votes1
answer535
viewsGrab object inside JSON string
I receive the following JSON from a web service / `{ “SinteseCadastral”: { “Documento”: “99999999999”, “Nome”: “NOM DE TESTES”, “NomeMae”: “NOME DA MAE DE TESTE”, “NomeFantasia”: “NOME FANTASIA DE…
-
1
votes1
answer115
viewsProblem in the setListData
I did the example of the book "Java How to program". I’m having trouble on the line copyJList.setListData(colorJList.getSelectedValue()); Could someone help. package…
-
1
votes1
answer114
viewsThe program cannot call the set method from another class, even with it instantiated
When I call the method setNomedoMetodo() in another class, even with it instantiated, appears: The method setNaipe(String[]) is Undefined for the type Deck. I can’t put a value on that method. And I…
javaasked 6 years, 5 months ago Marcos Paulo S. Rezende 351 -
1
votes1
answer900
viewsSort a chained list with Java Selection algorithm
I am working on sorting algorithms. I have implemented sorting with Bubble Sort, however, must be implemented with an example where the algorithm is not stable( Selection ,Quicksort, Heapsort or…
-
1
votes1
answer2601
viewsDate formatting error when it is on Brazilian daylight saving time (BRST)
I have a problem when removing from a date variable (Sun Oct 21 01:00:00 BRST 2018) that one hour difference, because it is generating a billing error, when the date is footprint of the database…
-
1
votes1
answer82
viewshow to take a substring of size n that repeats
I have the following entry: aaisndiaunwioun test|test saiudb8iuyb aiwbu diby tab fiubaw palavragrande|palavragrande asibtiubi How to make the algorithm return test and palavragrande only if it’s…
-
1
votes1
answer144
viewsHow to use the Strings file inside the code
Hello, inside the Mainactivity XML in Android Studio I can use @string/STRING I would like to know how I would reference a string I have inside the strings.xml in the res folder of Android Studio.…
-
1
votes1
answer597
viewsSpringboot - JPA - does not migrate relationships in the entity and relationship diagram
I am creating a Rest application using Springboot, JPA and as a Mysql database. It works well, but it has something strange when I enter the database. I used Workbench to create the relational…
-
1
votes1
answer67
viewsFirebase database reset data when soon
I was studying Firebase and created a login method with email and password, but I did not want to use this, so I learned to use Google Auth, so I decided to associate the google auth account in the…
-
1
votes0
answers80
viewsDownload database data in csv format
I am trying to download the database data in csv format but it is indicating that the SQL syntax is wrong. public void exportarBaseRespostaPI() { String banco = "b2wentregascorreios"; String tabela…
-
1
votes1
answer257
viewsPersistence in JPA Cascade
I’m trying to perform a cascade persistence using JPA. I have the entity: Course and Module 1 Course can have several Module @Entity(name = "course") public class Course extends BaseEntity { private…