Tagged Questions
0
votes
1answer
17 views
Syntax error while making 2-Dimensional LinkedList
I'm trying to make a 2-Dimensional LinkedList in Java and this is what I have come up with:
LinkedList<LinkedList<String>> rows = new LinkedList()<LinkedList<String>>;
...
0
votes
0answers
24 views
JPQL polymorphism, TYPE operator syntax error
I have a Article class which is extended by Recipe and Review classes and when I want to get just the article class using the TYPE operator like this,
getEntityManager().createQuery("SELECT e FROM " ...
0
votes
2answers
98 views
Missing identifier even though it's defined one line above? [closed]
Let's see this trivial Java program:
class A {
public static void main(String[] args) {
int а = 2;
System.out.println("a " + a);
}
}
It creates the variable a initialized to ...
0
votes
4answers
59 views
Syntax meaning of '< >' in Java [duplicate]
I am manipulating some code and unfortunately I cannot understand this part of it:
public class InMemoryTreeStateManager<T> implements TreeStateManager<T>
What is the meaning of ...
4
votes
1answer
38 views
In the source files of an Eclipse plug-in, why are a lot of variables prefixed with “f”?
I'm going through the source code for Eclipse plugins (right now I'm exploring the class TextMergeView) and I notice ALOT of variables are given the starting letter f.
I know that we often give ...
0
votes
3answers
111 views
Syntax error on token “;” … why?
why is there syntax error on this line ( shown below ) ? Thanks
import java.util.StringTokenizer;
public class Tokenizer
{
public Tokenizer()
{
}
int n;
String ...
1
vote
2answers
61 views
What does the pipe character do in a Java method call?
I've seen the pipe character used in method calls in Java programs.
For example:
public class Testing1 {
public int print(int i1, int i2){
return i1 + i2;
}
public static void ...
-1
votes
5answers
73 views
return void in a void method?
I know I can do this:
void someMethod(){
return;
}
but I get a syntax error on
void someMethod(){
return void;
}
Why is the latter not allowed? It makes more sense to me.
Edit: I know what ...
1
vote
2answers
68 views
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'Smith' in 'where clause'
hope you can help me. I get the error
"com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown
column 'Smith' in 'where clause'".
I have a database called "aspirante" and it has a ...
1
vote
4answers
35 views
Java and MYSQL Syntax Issue
I'm trying to insert data into my MYSQL databse. I want to insert an int into the database which I have no problem doing. However, I want to INSERT INTO (VALUES) WHERE. I get a MYSQL syntax error ...
-2
votes
0answers
44 views
Ghost syntax error?
I have looked over the code multiple times and cannot find any missing braces. Is there something else that I'm doing wrong that is causing the error? I'm just learning to use GUIs so that is entirely ...
1
vote
3answers
45 views
Need to understand this line of Java using the ? conditional operator
I'm currently working on a project and came across a couple lines of code like this:
List<Map<Sring, ? super Serializable>> list = new ArrayList<Map<String, ? super ...
0
votes
0answers
51 views
Syntax error driving me crazy
Probably a simple answer, but I can't figure it out. The onCreateDialog(int id) method shows errors under both of the parenthesis (before the int and right after the d). The error says "Syntax error ...
-1
votes
1answer
150 views
Slope between two points in X,Y,Z coordinate system
I took a course in Java at University 2 years ago, and now I have to create a program where I type in 2 sets of coordinates, and the program will create a 3-D graph of a line between the two points, ...
-8
votes
1answer
87 views
Syntax error on token “}”, { expected after this token [closed]
I'm getting an error stating "Syntax error on token "}", { expected after this token" and I have NO idea why...
The error occurs at the } before return START_STICKY;
If I remove the } or add a { ...
0
votes
2answers
29 views
Processing parentheses syntax
This might seem like a very simple question, but I am quite confused.
I have an if condition with many conditions in it and I cannot figure out the parentheses syntax to be used in this case. Could ...
1
vote
4answers
52 views
Java primitive declaratiron
Given the following code snippet:
int i = 0;
int y = + ++i;
System.out.println(y);
The result is 1. Why is this a valid declaration? Can anyone explain what is =+?
1
vote
3answers
30 views
What does a static import of star from a static inner class do?
I was looking at the source of List.map in Functional Java and saw it was using some class called Buffer, but couldn't find the class anywhere, then I looked at the imports and realized it was an ...
1
vote
1answer
36 views
Close server button problems
I am new to java. I start my server with a button
JButton startServerButton = new JButton("Start");
startServerButton.addActionListener(new ActionListener() {
public void ...
-2
votes
2answers
35 views
BorderLayout correct syntax
as far as i know the syntax of the add method is
add(Component , String);
ex.
add(new Button("North"), BorderLayout.NORTH);
but i saw that syntax of the add method in a class and it passses ...
-3
votes
0answers
52 views
Syntax error with Android array adapter [closed]
I'm currently experiencing an error I can't seem to resolve.
I'm trying to display a list of names to an Android list view but can't seem to get the Array Adapter to work properly. The purpose of my ...
0
votes
2answers
69 views
Error on token “;” , { expected GUI
I am trying to do a calculator, and I use some boolean variables to check if a dot has already been added, and if the user is inputting the second number.
The problem is in the lines I commented. I ...
0
votes
1answer
41 views
How to assign new users different text files
The program that I am working on asks the user if they are a new user or not and if the user is a new user you have to assign their very own txt file for their personalized music database. The txt ...
0
votes
1answer
24 views
Second set of brackets in JMock expectations
In JUNIT tests, I'm using JMOCK. In some samples, I have seen code similar to the following snippet:
mock.checking(new Expectations(){
{
allowing(tmp).assign(
...
0
votes
0answers
40 views
Syntax Error on Token(s), Misplaced Constructor using a HashMap [closed]
So I am using a HashMap called Player and trying to get the values inside of it and assign it to an Object array. The code looks like this.
if (command.equals("print")){
arr = ...
0
votes
1answer
17 views
Is there a simple way to directly define binary numbers? (such as an equivalent to the 0x-notation for hexadecimal numbers)
If I have the hexadecimal representation of a number, say f2, I can directly store the number as an int using.
int num = 0xf2;
Then,
System.out.println(num);
yields the output
242
What if I ...
2
votes
4answers
75 views
Grammar description for language Java
I'm writing a bachelor's thesis on "Analysis of the source code in Java applications". I have a few points that must include written part. One of them is "a brief description of the grammar and ...
5
votes
3answers
105 views
Java int += double syntax surprise [duplicate]
I have run into the following surprising line:
int x = 7;
x += 0.5;
is apparently legal syntax! After the addition, x is still 7, so the double is being cast to an int and rounded down to 0, but ...
2
votes
2answers
51 views
Semantic meaning of String array [duplicate]
Sorry if this is already been answered but searching with [] doesn't help you a lot.
While writing in Java I started wondering whether there's any semantic difference between these declarations:
...
55
votes
3answers
3k views
What is the underscore actually doing in this Java code? [closed]
I just began to learn Java.
My friend who is helping me study just sent me this and said 'figure this out'.
Unfortunately I am unable to read this. It looks like Perl to me.
class _{_ ...