hi,
Let me know if this solves your problem....
Please read comment carefully..\
/*
Author: Agbebiyi Babajide
Location: South Africa
Schoo;: Tswhane University of Technology
E-mail: jydeshow@gmail.com, Agbebiyib@hotmail.com
Dept: ICT/ Enterprise Applications Development
Remark: This very simple program is to check wether an array
element repeats it self.
This code can be reused as long as the comment is not changed or altered..
*/
public class ArrayDemo{
// check to see if its unique or not
boolean type;
public static void main (String[] Agbebiyi){
// from static to non static, SAME as==================
// ArrayDemo ad= new ArrayDemo();
// ad.startApp();
new ArrayDemo().startApp();
}
public void startApp(){
int [] numbers={2,3,4,5,6,7,8,9,0,11,12};
// initalize array, can also get values from JOptionPane or scanner
// Outer loop
for(int x=0; x<numbers.length;x++){
// inner loop, this will go through all elements from 0 to last.
// this loop is controlled by the outer loop
for(int y=0; y<numbers.length;y++ ){
if(numbers[x]==numbers[y++]){
type=true;
}
else
{
type=false;
}
}
}
//print ur output
System.out.println("Array is "+ type);
}
}// end of class