Questions tagged as 'java'

2
answers

While Within While (While Main Stops)

I need to create 2 loops going from 1 to 10, just one inside another. WORKS Using for and for. Using while and for. Why does not it work? 1) WHILE AND WHILE int a=1, b=1; while(a<=10) { while(b<=10)...
asked by 27.03.2018 / 17:19
1
answer

ClassNotFoundException error

Good afternoon, what does the following error mean? Class not found stancedriver.StanceDriver java.lang.ClassNotFoundException: stancedriver.StanceDriver at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loa...
asked by 09.06.2017 / 21:59
1
answer

Error reading a long number in java

I'm reading a vector in java and making the sum of all elements but this is saying that they are incompatible type, how to solve My code package capitulo2; import java.util.Scanner; public class Capitulo2 { public static void main(String...
asked by 01.07.2018 / 23:18
4
answers

Concise conditional structure with multiple comparisons

How to compare three items with the same result? I'm currently doing the following, but so the code design does not look elegant. if ($title == 0 && $squad == 0 && $level == 0) { return true; } What I'm wanting is somethi...
asked by 05.04.2018 / 18:21
1
answer

Method does not return correct value

I have the following code: public class Main { public static void Main (String[] args) { Metodo R = new Metodo(); Scanner entrada = new Scanner(System.in); int[] valores = new int[10]; int i = 0; whi...
asked by 06.04.2014 / 04:27
1
answer

CircularReferenceException error

I need some help, I have this: com.thoughtworks.xstream.core.TreeMarshaller $ CircularReferenceException And I can not find the solution. Here is the snippet of code: XStream xstream = new XStream(new JettisonMappedXmlDriver()); xstrea...
asked by 05.06.2017 / 15:50
2
answers

switch not recognizing ENUM as constant [duplicate]

public enum enumUpdateAction { NEW(0), CHANGE(1), DELETE(2), DELETE_THRU(3), DELETE_FROM(4); public int codigo; enumUpdateAction(int codigo) { this.codigo = codigo; } public int getCodigo() { return this.c...
asked by 24.02.2017 / 18:54
3
answers

Write in files without deleting your content

How can I write to a file without deleting what's inside it? I'm using the classes below. public void criarArquivos() throws IOException{ /*1 forma*/ FileWriter arqTeste = new FileWriter("teste.txt"); PrintWriter gravaTeste = new...
asked by 24.11.2016 / 14:54
3
answers

Array problem in Java

I'm trying to create a contacts calendar in java, I'm using some classes that were requested in the exercise. the main class: import java.util.Scanner; public class Lista15Q03 { public static void main(String[] args) {...
asked by 03.01.2017 / 16:59
1
answer

Execute a function from a class [closed]

I would like to know if it is possible to execute a certain function only when the activity is called by another particular activity . for example: Activity A called Activity B , in this case execute Y function, but if...
asked by 06.01.2017 / 12:35