class Swap
{
public static void main(String…s)
{
int a,b,temp;
a=Integer.parseInt(s[0]);
b=Integer.parseInt(s[1]);
System.out.println(“nBefore Swap:n”+”a=”+a+”tb=”+b);
temp=a;
a=b;
b=temp;
System.out.println(“nAfter Swap:n”+”a=”+a+”tb=”+b);
}
}
hello i am student programmner and i need to someone help me
i can´t to do any proyect, i really want to learn.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package convertbinary;
public class Convertbinary {
public static void main(String…s) {
int a;
int b;
int temp;
a=Integer.parseInt(s[0]);
b=Integer.parseInt(s[1])
System.out.println(“nBefore swap:n”+”a=”+a+”tb=”+b);
temp=a;
a=b;
b=temp;
System.out.println(“nafter swap:n”+”a=”+a+”tb=”+b);
}
}
Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: 0
at convertbinary.Convertbinary.main(Convertbinary.java:36)
Java Result: 1
Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: 0
shows error
u have to pass parameters via command line arguments aastha
Write public static void main(String args[])throws Exception
Correction:
Put a \(backslash) before n and t in system.out commands for accurate result