(New page: == JAVA FAQ == Q: How do I initialize and create a list in java? A: ---- [https://kiwi.ecn.purdue.edu/rhea/index.php/2009_Fall_ECE_462_Lu Back to ECE462])
 
m
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
 
== JAVA FAQ ==
 
== JAVA FAQ ==
  
Q: How do I initialize and create a list in java?
+
Q: How do I initialize and create a list in java? A source code example would be beneficial.
 +
 
 +
A: Do you mean an array? Here are some examples from [http://java.sun.com/docs/books/jls/second_edition/html/arrays.doc.html Java's website]
 +
<source lang=java>
 +
int[] factorial = { 1, 1, 2, 6, 24, 120, 720, 5040 };
 +
char ac[] = { 'n', 'o', 't', ' ', 'a', ' ',
 +
'S', 't', 'r', 'i', 'n', 'g' };
 +
String[] aas = { "array", "of", "String", };
 +
</source>
 +
 
  
A:
+
Q: I can't find anything wrong with my code but it doesn't compile or I get a segmentation fault. How is a minor change making my program fail? My code is written in C++.
  
 +
A: The problem is that the Makefiles for C++ may not update with the new code since the changes are small. This causes miscommunication and ultimately a crash. The solution is to clean and then make. (A better explanation may be necessary)
  
 
----
 
----
  
 
[https://kiwi.ecn.purdue.edu/rhea/index.php/2009_Fall_ECE_462_Lu Back to ECE462]
 
[https://kiwi.ecn.purdue.edu/rhea/index.php/2009_Fall_ECE_462_Lu Back to ECE462]

Latest revision as of 07:22, 9 October 2009

JAVA FAQ

Q: How do I initialize and create a list in java? A source code example would be beneficial.

A: Do you mean an array? Here are some examples from Java's website

int[] factorial = { 1, 1, 2, 6, 24, 120, 720, 5040 };
char ac[] = { 'n', 'o', 't', ' ', 'a', ' ',
				 'S', 't', 'r', 'i', 'n', 'g' }; 
String[] aas = { "array", "of", "String", };


Q: I can't find anything wrong with my code but it doesn't compile or I get a segmentation fault. How is a minor change making my program fail? My code is written in C++.

A: The problem is that the Makefiles for C++ may not update with the new code since the changes are small. This causes miscommunication and ultimately a crash. The solution is to clean and then make. (A better explanation may be necessary)


Back to ECE462

Alumni Liaison

Ph.D. 2007, working on developing cool imaging technologies for digital cameras, camera phones, and video surveillance cameras.

Buyue Zhang