Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Java
  4. sorted [modified]

sorted [modified]

Scheduled Pinned Locked Moved Java
javahelpquestion
5 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    salemmohamed
    wrote on last edited by
    #1

    I have program by java: I want to do the following 1- read from file integer number 2- after reading sort the integer number import java.io.*; import javax.swing.*; import java.util.*; import java.util.Arrays; class read1 { File infile;int n=10; public void getInput() { try { JFileChooser jfc = new JFileChooser(); jfc.showOpenDialog(null); infile=jfc.getSelectedFile(); FileInputStream fis =new FileInputStream(infile); Scanner sc=new Scanner(fis); int[] arrayToSort = new int[] Arrays.sort(arrayToSort); for (int i = 0; i < arrayToSort.length; i++) System.out.println(arrayToSort[i]); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { read1 e=new read1(); e.getInput(); e.sortIntArray(); } } my question this program execute but problem in this line int[] arrayToSort = new int[]

    modified on Friday, March 19, 2010 8:58 AM

    L G 3 Replies Last reply
    0
    • S salemmohamed

      I have program by java: I want to do the following 1- read from file integer number 2- after reading sort the integer number import java.io.*; import javax.swing.*; import java.util.*; import java.util.Arrays; class read1 { File infile;int n=10; public void getInput() { try { JFileChooser jfc = new JFileChooser(); jfc.showOpenDialog(null); infile=jfc.getSelectedFile(); FileInputStream fis =new FileInputStream(infile); Scanner sc=new Scanner(fis); int[] arrayToSort = new int[] Arrays.sort(arrayToSort); for (int i = 0; i < arrayToSort.length; i++) System.out.println(arrayToSort[i]); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { read1 e=new read1(); e.getInput(); e.sortIntArray(); } } my question this program execute but problem in this line int[] arrayToSort = new int[]

      modified on Friday, March 19, 2010 8:58 AM

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Suggestion: put your code between <pre></pre> tags to make it readable. Hint: use the code block button in the editor. Question: what is your problem?

      txtspeak is the realm of 9 year old children, not developers. Christian Graus

      1 Reply Last reply
      0
      • S salemmohamed

        I have program by java: I want to do the following 1- read from file integer number 2- after reading sort the integer number import java.io.*; import javax.swing.*; import java.util.*; import java.util.Arrays; class read1 { File infile;int n=10; public void getInput() { try { JFileChooser jfc = new JFileChooser(); jfc.showOpenDialog(null); infile=jfc.getSelectedFile(); FileInputStream fis =new FileInputStream(infile); Scanner sc=new Scanner(fis); int[] arrayToSort = new int[] Arrays.sort(arrayToSort); for (int i = 0; i < arrayToSort.length; i++) System.out.println(arrayToSort[i]); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { read1 e=new read1(); e.getInput(); e.sortIntArray(); } } my question this program execute but problem in this line int[] arrayToSort = new int[]

        modified on Friday, March 19, 2010 8:58 AM

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        salemmohamed wrote:

        my question this program execute but problem in this line

        Well you have not specified any size for the array you are trying to create.

        txtspeak is the realm of 9 year old children, not developers. Christian Graus

        1 Reply Last reply
        0
        • S salemmohamed

          I have program by java: I want to do the following 1- read from file integer number 2- after reading sort the integer number import java.io.*; import javax.swing.*; import java.util.*; import java.util.Arrays; class read1 { File infile;int n=10; public void getInput() { try { JFileChooser jfc = new JFileChooser(); jfc.showOpenDialog(null); infile=jfc.getSelectedFile(); FileInputStream fis =new FileInputStream(infile); Scanner sc=new Scanner(fis); int[] arrayToSort = new int[] Arrays.sort(arrayToSort); for (int i = 0; i < arrayToSort.length; i++) System.out.println(arrayToSort[i]); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { read1 e=new read1(); e.getInput(); e.sortIntArray(); } } my question this program execute but problem in this line int[] arrayToSort = new int[]

          modified on Friday, March 19, 2010 8:58 AM

          G Offline
          G Offline
          Gwenio
          wrote on last edited by
          #4

          salemmohamed wrote:

          int[] arrayToSort = new int[]

          1. Inside the [] at the end, specify a length for the array. 2. You left off the semicolon at the end of the line.

          T 1 Reply Last reply
          0
          • G Gwenio

            salemmohamed wrote:

            int[] arrayToSort = new int[]

            1. Inside the [] at the end, specify a length for the array. 2. You left off the semicolon at the end of the line.

            T Offline
            T Offline
            TorstenH
            wrote on last edited by
            #5

            ...and please use an eclipse IDE (DownloadPage for Galileo 32Bit) . It will show you this kind of fault "in real time" and help you fix'em. greets Torsten

            I never finish anyth...

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups