-2

Hey I have been trying to get the main to run the methods but I don't remember how to do it. It is a simple program so far because I just started on it 15 minutes ago.

`

import java.awt.Robot;
import javax.swing.JFrame;
import java.lang.*;
import java.io.*;
public class sweetRevenge {

public static void main(String[] args) {
//call local static classes browserjacker and wallpaperjacker
   start(browserJacker(1));




   } 


   public static void browserJacker(int i)throws IOException{
 try
 { 
//include bad things along with self made video of hacking linked to youtube
 Process p=Runtime.getRuntime().exec("cmd /c start http://www.google.com"); 
 } 
 catch(IOException e1) {System.out.println(e1);} 

 }
 public static void wallpaperJacker (String args []) throws IOException {
Process p=Runtime.getRuntime().exec("cmd /c start");
  }}

`

4

1 に答える 1

0
since your method is throwing an exception so the place where you will call it MUST have an exception handling mechanism, and your code needs to be modified.

import java.awt.Robot;
import javax.swing.JFrame;
import java.lang.*;
import java.io.*;
public class sweetRevenge {

public static void main(String[] args) {
//call local static classes browserjacker and wallpaperjacker

   try{
     browserJacker(); // will start method browserJacker
     // since the method is static so it can be easily accessed from static method
   }catch{IOException ex}{
   }

} 

public static void browserJacker()throws IOException{
   //include bad things along with self made video of hacking linked to youtube
   Process p=Runtime.getRuntime().exec("cmd /c start http://www.google.com"); 
}

 public static void wallpaperJacker () throws IOException {
   Process p=Runtime.getRuntime().exec("cmd /c start");
     }
}
于 2013-04-13T03:40:21.180 に答える