August 19, 2008 at 10:47 AM
Hi friend,
Your code having error :
You not have declare any main method
So java.lang.NoSuchMethodError: main error occur
and you add this main method in bubbleSort1 class.
public static void main(String a[]){
int i;
int array[] = {10,5,3,89,110,120,1,8,2,12};
System.out.println("Values Before the sort:\n");
for(i = 0; i < array.length; i++)
System.out.print( array[i]+" ");
System.out.println();
bubbleSort(array);
System.out.print("Values after the sort:\n");
for(i = 0; i <array.length; i++)
System.out.print(array[i]+" ");
System.out.println();
System.out.println("PAUSE");
}
Complete code for a class bubbleSort1
class bubbleSort1{
public static void main(String a[]){
int i;
int array[] = {10,5,3,89,110,120,1,8,2,12};
System.out.println("Values Before the sort:\n");
for(i = 0; i < array.length; i++)
System.out.print( array[i]+" ");
System.out.println();
bubbleSort(array);
System.out.print("Values after the sort:\n");
for(i = 0; i <array.length; i++)
System.out.print(array[i]+" ");
System.out.println();
System.out.println("PAUSE");
}
public static void bubbleSort(int[] x) {
int n = x.length;
for (int pass=1; pass < n; pass++) { // count how many times
// This next loop becomes shorter and shorter
for (int i=0; i < n-pass; i++) {
if (x[i] > x[i+1]) {
// exchange elements
int temp = x[i]; x[i] = x[i+1]; x[i+1] = temp;
}
}
}
}
}
For read more information :
http://www.roseindia.net/java/Thanks
Related Tutorials/Questions & Answers:
to solve the error - Java Beginnersto
solve the error class bubbleSort1{
public static void...,
Your code having
error :
You not have declare any main method
So java.lang.NoSuchMethodError: main
error occur
and you add this main method
How to Solve the Syntax Error in java??How to
Solve the Syntax
Error in java?? Syntax
error in java?
i have tried this program its showing
error like this in Eclipse "Syntax
error... of the program "objectname.i"
What is the reason for this
error??How to access the variable
Advertisements
how to solve 'Stop Running This Script' Error ?how to
solve 'Stop Running This Script'
Error ? Hi..
When opened the page on IE browser(version : 8.0),it gives an java script
error (i.e.Stop Running This Script).
I have used jsp/servlet for this.
Please help to resolved
how to solve this kind of error in Eclipse IDE? how to
solve this kind of
error in Eclipse IDE? i'm creating... are installed. but i'm getting exactly this
error, any one out of this problem of
error. thanks in advance.
![this is image of
error, and i will try to start
Solve itSolve it How to calculate the value which contains oparator and operand both using command line argument
solve thissolve this
Create a student class. The student object should have studentid, studentname, subject and marks as properties. Also generate the getter and setter methods. Create 5 objects of this class and populate values
error(DriverManager.java:171)
at excelDB.ExcelDB.main(Excel_DB.java:210)
how to
solve dis
error errorerror java.lang.unsupportedclassversionerror:bad major version at offset 6
how to
solve this????
Hi,
Please check the version of framework used and also the JDK version.ADS_TO_REPLACE_1
This type
error also comes
solve this pbmsolve this pbm its not working the code for databae access using servlets
ModuleNotFoundError: No module named 'solve'ModuleNotFoundError: No module named '
solve' Hi,
My Python program is throwing following
error:
ModuleNotFoundError: No module named '
solve..., ModuleNotFoundError: No
module named '
solve'
error will be solved.
Thanks
ErrorError Hi. I am getting
error in the following code after the line I have commented as
ERROR. How to
solve this. Thanks in advance.
package...;");
//
ERROR
out.println(" var pattern
ErrorError Hi. I am getting
error in the following code after the line I have commented as
ERROR. How to
solve this. Thanks in advance.
package...;");
//
ERROR
out.println(" var pattern
ErrorError Hi. I am getting
error in the following code after the line I have commented as
ERROR. How to
solve this. Thanks in advance.
package...;");
//
ERROR
out.println(" var pattern = /^\d{3,5
ErrorError Hi. I am getting
error in the following code after the line I have commented as
ERROR. How to
solve this. Thanks in advance.
package...;");
//
ERROR
out.println(" var pattern
how to solve how to
solve log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources).
log4j:WARN Please initialize the log4j system properly
solve this pbmsolve this pbm sir rows are also inserting i have checked in the database also the rows are not affected in the table .
The first pbm wich i have sent to you is not yet solved..........
pls give me detail explaination how we
errorerror while iam compiling iam getting expected
error Error- Error- Hello, I would like to know about XSD file.
I try to print XML file but I am getting
error SAXException-- says
Content is not allowed in prolog.
Please help me
errorerror i have 404
error in my program plz tell me yhe solution about
errorerror i have 404
error in my program plz tell me yhe solution about
error/ServletUserEnquiryForm.shtml
getting an
error given below
SQLException caught: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax
error
please suggest
ErrorError I have created ajax with php for state and city. When I change state then city will not come in dropdown list and it give me
error as 'Unknown Runtime
Error'.
This
error come only in IE browser, but in other brower
errorerror When I deploye the example I have this message
cannot Deploy HelloWorld
Deployment
Error for module: HelloWorld:
Error occurred during deployment: Exception while deploying the app [HelloWorld
error!!!!!!!!!error!!!!!!!!! st=con.createStatement();
int a=Integer.parseInt(txttrno.getText());
String b=txttname.getText();
String c=txtfrom.getText();
String d=txtto.getText
error!!!!!!!!!error!!!!!!!!! st=con.createStatement();
int a=Integer.parseInt(txttrno.getText());
String b=txttname.getText();
String c=txtfrom.getText();
String d=txtto.getText
error!!!!!!!!!error!!!!!!!!! st=con.createStatement();
int a=Integer.parseInt(txttrno.getText());
String b=txttname.getText();
String c=txtfrom.getText();
String d=txtto.getText
error"+it);
}
}
this is my program i am getting an
error saying cannot find symbol class stringADS
errorerror whats the
error..............
import java.util.Scanner;
public class g {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int d,x,y;
System.out.println("Enter the first number
solve this problemsolve this problem I typed this program and compiled.The program is compiled but when i eneterd url in tomcat server. Its not giving
error but only blank page is coming the text is not displaying and row is also inserted
how to solve this..how to
solve this.. Given a list of students and their marks
Name | Science | Math | English | Computer
Ahmad | 28 | 100 | 66 | 34
Samad | 56 | 89 | 55
how to solve this..how to
solve this.. Given a list of students and their marks
Name | Science | Math | English | Computer
Ahmad | 28 | 100 | 66 | 34
Samad | 56 | 89 | 55
please solve this programplease
solve this program Build a package
EMPPACK that contains one stored function Validatesal() and two stored
procedures Insertemp... an exception with an
error message -?Salary Out of
range?.The Getemp_deails
how to solve an internet connection problemhow to
solve an internet connection problem when i run my application it give me this
error:
Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: Not yet implemented
the problem is that i don`t know