-2

嘿,我一直在尝试让 main 运行这些方法,但我不记得该怎么做。到目前为止,这是一个简单的程序,因为我 15 分钟前才开始使用它。

`

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 回答