Questions tagged as 'java'

3
answers

Difference between "Attribute" and "Instance Variable"

Reading some books and articles on introducing Java and OO I noticed that these terms are not well defined. Looking deeper I found different definitions in different sources on the subject. What is the real difference between these types of vari...
asked by 06.11.2015 / 14:42
2
answers

Why ArrayList instead of Stack in the implementation of Memento pattern?

As you all know, the Memento pattern is the default that saves different states of objects and then retrieves them. The intent is not to retrieve the "last" entry and then remove it? This is a stack, right? So why do examples use ArrayL...
asked by 31.12.2014 / 12:50
2
answers

How to generate .jar executable program in NetBeans?

I made an application in Java and I liked it, now I need to get executable to show my colleagues. How do I get the executable?     
asked by 07.08.2014 / 21:14
2
answers

Variables with BigDecimal

I'm trying to add a value to a variable of type BigDecimal, however regardless of the calculation it results in 0. Sample code: BigDecimal valorTotal = new BigDecimal(0); public void adicionarVenda(int idProduto, int quantidade) {...
asked by 04.04.2014 / 05:01
3
answers

Running jar on client from browser

I need to run a jar file that should be on the client's pc through the web and pass some parameters to that jar, I managed to do this with exec() of php: exec('java -jar "C:\Users\Suporte01\Documents\NetBeansProjects\Printer\dist\Printe...
asked by 26.02.2014 / 13:41
2
answers

How to display a PDF in the browser with an ajax request?

I make a request like this: $.ajax({type : 'GET', url : URL_APP_CONSULTA_BOLETO_DIVIDA_ATIVA + url}); I have a java method that returns something like this: return (Response.ok(output).header("content-disposition", "attachment; filename =...
asked by 20.02.2014 / 16:00
2
answers

REST Secure Authentication

I searched and found no solution to the following problem: How do I track requests in a given REST service? For example, if I have a blog in which I access my services (insert post, remove post, update post, for example) as follows local...
asked by 22.03.2014 / 19:32
2
answers

Manipulate price in inventory control

I'm doing a stock control system in Java and I came across a question about how to store prices. I've been reading that double and float are not good for storing this type of data and for a data loss when doing calculations with th...
asked by 26.03.2014 / 22:58
1
answer

Cloned objects are not the same as when comparing with the Object.equals () method?

I was doing some equality testing, and when comparing two objects, being a clone of the other, I noticed that equals returns false , even the objects being identical. The return should not be true since they are cloned object...
asked by 11.01.2017 / 00:12
2
answers

What is inheritance of type and state?

Recently in a Java simulation, I came across a question related to inheritance classification, which I had never seen before. Taking advantage of the opportunity, I'll separate it into topics, so the answer is clearer: What is inheritanc...
asked by 15.03.2017 / 00:43