Attachment 1158
Attachment 1159
Attachment 1160
Attachment 1161
Attachment 1162
Attachment 1163
what should i do to solve this error ?
Printable View
Attachment 1158
Attachment 1159
Attachment 1160
Attachment 1161
Attachment 1162
Attachment 1163
what should i do to solve this error ?
yes of course andreas90 thanks before
package toy;
import java.io.*;
public class MathExploreToy{
/**create*/
public class MathExploreToy(){
}
static void test {
test E();
testPI();
testAbs();
}
static void betterTest(){
testinAbs();
}
static void betterTest(){
testIntAbs(){
}
static void test E
System.out.println("Testing untuk math.E");
System.out.println("Math.E= "+Math.E);
System.out.println("");
}
static void test PI(){
System.out.println("Testing untuk math.PI");
System.out.println("Math.PI = "+Math.PI);
System.out.println("");
}
static void testAbs(){
System.out.println("Testing untuk Math.abs()");
System.out.println("Math.abs(-23.7)="Math.abs(-23.7));
System.out.println("Math.abs(0.0)="Math.abs(0.0));
System.out.println("Math.abs(23.7)="Math.abs(23.7) ;
System.out.println("Double.MIN_VALUE = "+Double.MIN.VALUE);
System.out.println("Math.abs(Double.MIN_VALUE) ="Math.abs(Double.MIN_VALUE));
System.out.println("Math.abs(-Double.MIN_VALUE) ="Math.abs(-Double.MIN_VALUE));
System.out.println("Math.abs(Double.MAX_VALUE) ="+Double.MAX_VALUE);
System.out.println("Math.abs(Double.MAX_VALUE) ="+Math.abs(Double.MAX_VALUE));
System.out.println("Math.abs(-Double.MAX_VALUE)="+Math.abs(-Double.MAX_VALUE));
System.out.println("");
}
static void testIntAbs(){
System.out.println("cara pengujian yang lebih baik mendukung otomatisasi");
System.out.println("Testing untuk Math.abs() bagi bilangan bulat");
if (Math.abs(-23) !=23)System.out.println("Math(-23)::Error Hasil harus 23");
else System.out.prinln(Math(-23):: Correct!");
if (Math.abs(0) !=0)System.out.println("Math(0)::Error Hasil harus 0");
else System.out.prinln(Math(0):: Correct!");
if (Math.abs(23) !=23)System.out.println("Math(23)::Error Hasil harus 23");
System.out.println("integer.MIN_VALUE) = "+integer.MIN_VALUE);
System.out.println(Math.abs(Integer.MIN_VALUE) ="+math.abs(Integer.MIN_VALUE));
System.out.println("integer.MAX_VALUE) = "+integer.MAX_VALUE);
System.out.println(Math.abs(Integer.MAX_VALUE) ="+math.abs(Integer.MAX_VALUE));
if (Math.abs(Integer.MIN_VALUE) != (-Integer.MIN_VALUE))
System.out.println("Math(Integer.MIN_VALUE) :: Error!");
else System.out.println("Math(Integer.MIN_VALUE) :: Correct!");
if (Math.abs(Integer.MIN_VALUE) < 0)
System.out.println("Math(Integer.MIN_VALUE) :: Error! hasil harus > 0");
else System.out.println("Math(Integer.MIN_VALUE) :: Correct!");
System.out.println("\n\nPERHATIAN!");
System.out.println("Pengujian menunjukan hasil yang tidak sesuai dengan matematika\n"+"pada kondisi batas sangat sulit diprediksi, untuk itu kita harus mengacu dokumentasi bahasa\n"+
"Pengujian otomatis kadang tidak dapat mengemukakan secara benar karena dibatasi juga\n"+
"Oleh kemampuan bahasa itu sendiri bila kesalahan adalah pada spesifikasi bahasa itu sendiri!\n"+
"Pengujian otomatis akan benar ditangan ahli, pengujian dapat ditambah abb\n"+
"Berdasarkan kenyataan bahwa hasil fungsi abs tidak boleh kurang dari nol);
System.out.println("\n"+ Di Java, Math.abs (Integer.MIN_VALUE) justru menghasilkan bilangan negatif.\n"+
"melanggar rumus matematika dimana hasil fungsi absolut selalu bernilai positif. \n"+
"Hasil ini dapat ditelusuri karena representasi int adalah two's complement \n"+
"Versi yang dipakai penulis :: JDK 1.5");
}
error is in line 5,52,54,58,60,73,74,80
erroe name: '{'expected , unclosed string lateral, unclosed string lateral, unclosed string lateral,unclosed string lateral, illegal character:\92, unclosed string lateral , '{'expected
You have many syntax errors. Inside your public class MathExploreToy and then you write
What is this? If you are trying to make a constructor this is not the appropriate way. Check again your curly braces and try fixing your errors and ask a specific question if you have. I suggest you reading the java tutorials for defining methods.Code java:public class MathExploreToy(){ }
And please use the highlight tags for better readability.
okay thanks for your comments its really good for my learning
You have it in the right place. java.io is not a function (method in java), it's a package. You can't import a method, you import packages (in the beginning of your code, before you declare your class). Here is java.io. If you are a begginner you should familiarize yourself with the Java API. And you should also google every question you have, you will find answers to almost everything.