Today I`m working with 3 programs all about arrays and I have few Qs... PLZ be updated with my topic because their are three programs and I`m working with number 1 now and so u see my other programs if i had any question or got stuck
First my Program is to sort array of integers by reading the size of array and all numbers then sorting them in ascending order ((( HOWEVER I CANT SORT IT USING SORT METHOD AS WE DIDN`T STUDY IT BECAUSE WE DIDN`T STUDY IT ,, WE SHOULD USE ANOTHER WAY !))
HERE IS MY PROGRAM
import java.util.Scanner;
public class Q1 {
public static void main(String[] args) {
import java.util.Scanner;
public class Q1 {
public static void main(String[] args) {
//a. make a scanner object
Scanner Keyboard= new Scanner (System.in);
int space;
System.out.println ("Enter the size of array");
space =Keyboard.nextInt();
int [] num= new int [space];
int [] stored= new int [space];
boolean [] check =new boolean [space];
boolean check = false; // my error is here that it says: Duplicate local variable check ((DO I CHANGE the name) i should set a boolean with
// the same size and to be defult
System.out.println ("Enter the numbers");
num [0] = Keyboard.nextInt();
int p =0;
while ( true ) {
space[0]=smallest; // <-- my error is The type of the expression must be an array type but it resolved to int
+ did i did it correct by setting the array space in the array num
Check my post because i have more than one program to write
LILYPOP

New Topic/Question
Reply




MultiQuote








|