Tagged Questions
Java is a general-purpose programming language designed to be used in conjunction with the Java Virtual Machine (JVM). "Java platform" is the name for a computing system that has installed tools for developing and running Java programs. Use this tag for questions referring to Java programming ...
0
votes
0answers
5 views
Function Definitions for Interfaces
Hello I have an assignment for my Graphical Programming Paper which requires you to design a Tetris-like game. They give you a skeleton code to start off with which I have posted below. My question is ...
0
votes
0answers
2 views
ArrayList of ArrayLists for pegs and discs in towers of hanoi game
I am building a towers of hanoi game that can be played from the console or the command line. Note this isn't a recursive program; I am trying to build a GAME that can be played by the user. I am ...
0
votes
0answers
5 views
Random Numbers and Counting Occurences in a Loop
I'm very new to Java and currently have an assignment dealing with loops and random numbers. The question is the following:
Modify ThrowingPairsOfDice.java to count and the number of times the pair ...
0
votes
1answer
6 views
Best method to parse an HTML document and replace whole segments of tags
I am trying to find the best way to parse an HTML document from top to bottom and
replace certain groups of tags for something different and create an updated file.
I prefer to use Java, VB.NET or ...
-1
votes
2answers
16 views
Method declaration on employee1 invalid need return type
I am getting an error on public static Employee1 saying it needs a return type required and that the method declaration is invalid. Ive tried changing it around but I don't know what I am doing wrong. ...
1
vote
1answer
28 views
Why does my try/catch block keep looping?
When I run this, the code skips over input.nextInt(); and goes in circles:
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
// Link user to programs (ToC)
...
-1
votes
0answers
15 views
Permutations using a 2D array
I need to write a short program that is able to output the permutations of the input which can be one of the following integers: 1, 2, 3, 4, 5 or 6. I need to store the permutations of in a 2D array ...
0
votes
0answers
10 views
Insertion into a priority queue implemented by doubly linked list with sentinels
I am writing a priority queue using doubly linked list with sentinels
class Node {
protected Node next;
protected Node prev;
protected int value;
public Node() {
}
public ...
0
votes
0answers
9 views
Form duplication of field, before MySQL posting of data
I have almost managed to fix a long standing problem I've been having with duplicate fields in my website, today I got a very quick solution to make the column data unique. An easy fix that had ...
0
votes
0answers
14 views
Arrays Group Counter java
Given a provided array, determine how many groups of a specified size exist.
For the array [1,1,1,2,2,2,3,3,3,4,5,6,7] , there are 7 groups with at least one, 3 groups with at least 2, and 3 groups ...
0
votes
2answers
14 views
Print first 40 elements in a list ordered by value
I still am not getting the top 40 le t me show you my code:
Map<String, Integer> doubleCount= new HashMap<>();
SortedMap<String,Integer> newMap= new TreeMap<>(doubleCount);
...
0
votes
0answers
16 views
is my try catch block required?
I have an aspect that intercepts a lot of methods in my code. I was wondering if joinPoint's signature and declaring type can ever be null. If no, then my try...catch is not required.
In other words, ...
0
votes
0answers
9 views
Java ProcessBuilder not able to run Python script in Java
null from bfr.readLine()
however there is no problem if I run the python file directly on terminal by firing:
python C:/Machine_Learning/Text_Analysis/Ontology_based.py
The last line in my Python ...
0
votes
0answers
3 views
Convert javax.mail.Message Email to XML format
I am looking for the open source API if there is any available which can convert javax.mail.Message object to XML specific format or some sample code if there is any already exist ?
Please let me ...
0
votes
0answers
7 views
Java program trying to find first and last index of word entered
I can not figure out why my program will display the first index of the word the user enters but I can not seem to get the second word to display the right index, also one other question if I would ...
0
votes
0answers
7 views
load .odt and parse its text in Java - the long explanation
Regards.
Before getting into the problem let me say that I have been at this for weeks.
I am making a small text analysis program (word count etc). I have core functionality down but my goal is ...
0
votes
1answer
20 views
Passing a String ArrayList to a method returning a double value
I'm working on an assignment question, which im stuck at:
i extracted a text file grades.txt to an arraylist called studentgrade
i want to then using the grades ive extracted to the arraylist to a ...
-2
votes
0answers
3 views
Missing quality profile after upgrading from SonarQube 4.1.2 to 4.2
I have just upgraded Sonarqube from 4.1.2 to 4.2.
After the upgraded all my quality profile shows only 2 rules.
I have not backed up the database so I just need to start from fresh.
Where can I ...
-1
votes
1answer
36 views
Having trouble with this rock paper scissors program
import java.util.*;
public class Lab6Part1 {
public static void main(String[] args) {
String rock, paper, scissors, userchoice = " ", compchoice = " ";
int computerInt, ties = 0, wins ...
0
votes
1answer
4 views
Difference between Context.openFileInput() and using the Java.IO classes
What is the difference between the Context IO API (openFileInput and openFileOutput) and using Java's IO API on Context.getFilesDir?
0
votes
0answers
11 views
GraphicsDevice isFullScreenSupported() = false, now what?
I'm facing the problem, that my Linux machine is returning false, when I check, if fullscreen mode is allowed. Is there a way to bypass this?
I currently use a nasty workaround, where I turn of all ...
0
votes
0answers
7 views
MGWT: How does MGWT Work with Super Dev Mode on GWT 2.7?
When using MGWT you can use SuperDevMode very easy as it was explained here: http://blog.daniel-kurka.de/2012/07/mgwt-super-dev-mode.html
gwt.xml config ist:
<add-linker name="xsiframe"/>
...
0
votes
0answers
14 views
2d arrays board game-limiting to only move per turn (java)
So in a 2d array of pieces called board that is an 8 x 8 checkers board. Let's say there's a method that returns void called pieceMove which takes parameters of int currentColumn, int currentRow, int ...
0
votes
1answer
23 views
How do I make time independent of the FPS?
I have a program which runs the tick() method every frame. I want an object to fall according to a set gravity constant, so I created a Ball object which will update its position to the position on ...
0
votes
0answers
11 views
Every Class File from LWJGL has no source
I just installed LWJGL and I selected lwjgl.jar, it loaded all the classes but when i click on one, it just says "This class has no source" Please help!
0
votes
0answers
5 views
Error while starting Oracle Weblogic Local Server 11g
Hi I am facing this error while starting my local Oracle Weblogic Server -
<Oct 2, 2014 5:07:17 PM PDT> <Critical> <WebLogicServer> <BEA-000386> <Server subsystem failed. ...
-1
votes
0answers
6 views
design patterns: command, command processor and command (ddd/cqrs)
Need to know the difference between all of these patterns, and what are their origins.
All these patterns encapsulate requests into command objects.
In command objects that you see in hexagonal/DDD ...
-2
votes
0answers
8 views
Android - About on licenses available to create and publish an Android Application
I want to know if there are any restrictions on licenses for my application, have thought about having my application under the license Creative Commons. I want to protect my application of ...
1
vote
1answer
15 views
divisors of a number java while loop
I have this Java code that I wrote for an assignment, however I used a for loop, when we were only allowed to use while loops. How would I be able to convert this to a while loop?
The intention of ...
1
vote
2answers
17 views
Text file to string matrix java
I am making an auto chat client like Cleverbot for school. I have everything working, but I need a way to make a knowledge base of responses. I was going to make a matrix with all the responses that I ...
2
votes
2answers
16 views
Non recursive floor method for Binary search tree
I have been trying to get this to work but while it works for majority of the input sometimes it gives the wrong output. I have spent some time debugging the code and it seems the problem is when i ...
0
votes
0answers
9 views
How do you extend a class using composition which requires a more specialized constructor argument?
I am trying to extend classes using composition where possible. But I am having trouble with a particular problem.
Lets say I have a Base class and an Extending class. The Extending class takes in an ...
-1
votes
0answers
22 views
FractionInterface
I am horrible when it comes to using methods (they confuse me more than anything in java) and I having the issue of trying to complete methods in this java file that my teacher gave us for one of our ...
0
votes
3answers
17 views
How to convert a set of Map keys to an Array List
How can I put a collection of my Map's keys as an Array List?
I am initializing the map as follows:
Map foo = new HashMap<Character,Integer>();
After adding values, I am trying to put my ...
-2
votes
0answers
9 views
Extracting all Pandora likes [on hold]
I know this is obviously a much larger and more complicated project than one would think but i definitely am going to try and do this whatever it happens to take. I basically want the end product to ...
0
votes
0answers
5 views
SVNKit authentication error E170001, but only when checking out and only on one computer
I'm completely stumped by an SVNKit (1.8.5) error that I'm running in to. I'm using the following pattern to build up an Authentication Manager:
public static SVNRepository getSvnRepository(String ...
2
votes
2answers
32 views
java - synchronization block on byte[]
I'm familiar with basic java threading mechanism, however, got confused about one particular case. Below is the sample code.
static byte[] syncBuf;
// synchronized block of code
...
0
votes
0answers
12 views
Server returned HTTP response code: 400 for URL which I suspect is not an URL issue
Please consider my JAVA program(Servlet) below. For some reason, I keep on getting the following error for PUT and POST where as GET works fine with the same HTTP URL ( of course with some minor ...
-1
votes
0answers
18 views
Java Memory Leak on linux centos
3 hours after the server is opened server are memory overloaded. How can I fix it ?
Sorry for bad English.
Java profiller;
http://i.stack.imgur.com/3qDYb.png
0
votes
1answer
14 views
How do I deserialize this string to my POJO representation using Jackson in Java?
public class UpdateRequest {
@JsonProperty
private String id;
@JsonProperty
private String type;
@JsonProperty
private long version;
@JsonProperty("fields")
private ...
0
votes
4answers
32 views
Why we have to mention generic type parameter before the method return type?
Here on this page, it has the below code example to introduce the generic methods?
public static <K, V> boolean compare(Pair<K, V> p1, Pair<K, V> p2) {
return ...
-1
votes
1answer
34 views
java function to convert alphanumeric to integers
I'm trying to achieve the below logic in Java but stuck up as I'm a beginner.
I need to convert 1A, 1B, 2A, 2B, 3A, 3B...etc to 1,2,3,4,5,6...etc.The logic or the function should return the ...
0
votes
1answer
12 views
Why setBackground method can't set the background of my JPanel?
I am trying to build a simple oval slider program.
I gave the window's background color orange, but it's not setting the background as orange, rather a gray background. Moreover the slider can't pass ...
-3
votes
0answers
17 views
Great books for Java 2D Game Programming?
Hello,
I'm searching the net for about a week to find a good book about how to program 2D games in Java. But I only find some 1990's books on it, nothing recent! Grr.
I know you are, a lot of us, a ...
-1
votes
3answers
21 views
Passing object reference as itself to own method explicityly
Question out of curiosity.
Can you find any reason to pass object as parameter of its own method explicitly?
e.g.
someObject.someMethod(someObject);
Thanks in advance.
-1
votes
0answers
28 views
Main method not found and enum expected
Here is an implementation of the Stack data structure:
import java.util.ArrayList;
public class Stack {
private int size;
private int maxSize;
private final ArrayList<Object> ...
0
votes
0answers
11 views
Xms not working
import java.io.*;
public class Foo {
public static void main(String[] _args) {
System.out.println("free:" + Runtime.getRuntime().freeMemory() +
". max:" + ...
0
votes
1answer
14 views
Constants representation/design
I need a way of structuring a tree of constants in java.
For an API I have:action/request name and for each action a specific number of parameters
API_V00
action_1: param_1,param_2 ...;
...
0
votes
0answers
6 views
Push Notification not being displayed on a physical phone
I am using parse for my push notification, and the push notification works fine on emulators, but doesn't work on a physical device or a tablet.
Below is the code is used into the system:
...
0
votes
1answer
53 views
Algorithm to merge two objects the most efficiently
I have a class Level1 that contains a String and a list of Level2 objects. The Level2 objects each contain a String and a list of Level3 objects. The Level3 objects each contain 2 String attributes, ...