Click here to Skip to main content
15,926,281 members
Home / Discussions / Java
   

Java

 
GeneralRe: 2D Image Animation Pin
NazarHussain27-Jul-09 3:59
NazarHussain27-Jul-09 3:59 
GeneralRe: 2D Image Animation Pin
Nagy Vilmos27-Jul-09 4:05
professionalNagy Vilmos27-Jul-09 4:05 
GeneralRe: 2D Image Animation Pin
NazarHussain27-Jul-09 20:01
NazarHussain27-Jul-09 20:01 
Questionarray string index [modified] Pin
nuttynibbles25-Jul-09 1:03
nuttynibbles25-Jul-09 1:03 
AnswerRe: array string index Pin
Kujtim Hyseni25-Jul-09 1:29
Kujtim Hyseni25-Jul-09 1:29 
GeneralRe: array string index Pin
fly90425-Jul-09 2:59
fly90425-Jul-09 2:59 
AnswerRe: array string index Pin
fly90425-Jul-09 2:56
fly90425-Jul-09 2:56 
QuestionEfficient way of printing elements in Java?! Pin
Rajdeep.NET24-Jul-09 8:36
Rajdeep.NET24-Jul-09 8:36 
Hello Pals,

I've written a program which declares an array of size 3, initializes its elements and prints the elements. The program is as follows:

package Demo;
import java.io*;
public class A{
    public A(){}
    public static void main(String args[])throws IOException{
        int[] anArray=new int[3];
        anArray[0]=10;
        anArray[1]=20;
        anArray[2]=30;
        System.out.println("Array[0] index now contains: "+anArray[0]);
        System.out.println("Array[1] index now contains: "+anArray[1]);
        System.out.println("Array[2] index now contains: "+anArray[2]);
    }
}



Now, suppose the array size is very long say 100! Then, will I have to keep on typing System.out.println(anArray[0]......anArray[99]);???

Wont that be huge? I C#.NET, we have the for-each loop construct to print all the elements in an array. Similarly, can I implement the for-each loop here? I did try, but I get Error as this: missing .class

Can anyone help me with an effecient way of printing elements in Java?

Help will be greatly appreciated,
Rajdeep Big Grin | :-D

I calculate my days on earth..... approximately 55 years remaining for me to expire Wink | ;-)

AnswerRe: Efficient way of printing elements in Java?! Pin
fly90424-Jul-09 8:42
fly90424-Jul-09 8:42 
AnswerRe: Efficient way of printing elements in Java?! Pin
Nagy Vilmos27-Jul-09 3:37
professionalNagy Vilmos27-Jul-09 3:37 
AnswerRe: Efficient way of printing elements in Java?! Pin
EliottA5-Aug-09 9:12
EliottA5-Aug-09 9:12 
QuestionRun ruby code on java Pin
xax24-Jul-09 6:15
xax24-Jul-09 6:15 
AnswerRe: Run ruby code on java Pin
Kujtim Hyseni25-Jul-09 0:59
Kujtim Hyseni25-Jul-09 0:59 
QuestionReference in Java Pin
Kujtim Hyseni24-Jul-09 5:32
Kujtim Hyseni24-Jul-09 5:32 
AnswerRe: Reference in Java Pin
David Skelly24-Jul-09 6:12
David Skelly24-Jul-09 6:12 
AnswerRe: Reference in Java Pin
fly90424-Jul-09 6:21
fly90424-Jul-09 6:21 
AnswerRe: Reference in Java Pin
Kujtim Hyseni24-Jul-09 7:02
Kujtim Hyseni24-Jul-09 7:02 
GeneralRe: Reference in Java Pin
David Skelly26-Jul-09 22:35
David Skelly26-Jul-09 22:35 
GeneralRe: Reference in Java Pin
Kujtim Hyseni27-Jul-09 1:38
Kujtim Hyseni27-Jul-09 1:38 
GeneralRe: Reference in Java Pin
David Skelly27-Jul-09 2:18
David Skelly27-Jul-09 2:18 
AnswerRe: Reference in Java [modified] Pin
Kujtim Hyseni27-Jul-09 3:36
Kujtim Hyseni27-Jul-09 3:36 
GeneralRe: Reference in Java Pin
David Skelly27-Jul-09 5:34
David Skelly27-Jul-09 5:34 
GeneralRe: Reference in Java Pin
Nagy Vilmos27-Jul-09 5:54
professionalNagy Vilmos27-Jul-09 5:54 
QuestionIs Javascript question allowed here??? Pin
kKamel22-Jul-09 0:34
kKamel22-Jul-09 0:34 
AnswerRe: Is Javascript question allowed here??? Pin
fly90422-Jul-09 0:41
fly90422-Jul-09 0:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.