Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You got it wrong you need to extend the Thread Class in Ascending and FileCopy.</p> <p>Override the run method and do your operations there. From a third class, or one of those classes implement a main method which creates two threads and calls start() on them, otherwise speaking: </p> <pre><code>//Class FileCopy with a main method package java10; import java.io.File; import java.io.IOException; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileNotFoundException; class FileCopy extends Thread { public static void main(String[] args){ FileCopy fileCopy = new FileCopy(); Ascending ascending = new Ascending(); fileCopy.start(); ascending.start(); ascending.join(); fileCopy.join(); } @Override public void run() { try { File fileIn = new File("C:/Users/dis_YO_boi/Documents/Abhishek.txt"); File fileOut = new File("C:/Users/dis_YO_boi/Documents/Mallela.txt"); FileInputStream streamIn = new FileInputStream(fileIn); FileOutputStream streamOut = new FileOutputStream(fileOut); int c; while ((c = streamIn.read()) != -1) { streamOut.write(c); } streamIn.close(); streamOut.close(); } catch (FileNotFoundException e) { System.out.println("FileCopy: " + e); } catch (IOException e) { System.out.println("FileCopy: " + e); } } } //Class Ascending package java10; public class Ascending extends Thread { @Override public void run(){ int nums[]={-1,23,50,-100,34}; //print the values before ordering for (int i=0;i&lt;nums.length;i++) System.out.println(nums[i]); for(int i=0;i&lt;nums.length-1;i++){ for(int j=i+1;j&lt;nums.length;j++){ if(nums[i]&gt;nums[j]){ int temp=nums[i]; nums[i]=nums[j]; nums[j]=temp; } } } System.out.println("___________________________"); for (int i=0;i&lt;nums.length;i++) System.out.println(nums[i]); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload