• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Hi, I got a error

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
import java.util.*;

class ArraysTest2
{


public static Descending desc = new Descending();

static void printArray(Object[] a)
{
System.out.print("[");
for (int i = 0; i < a.length; ++i)
{
System.out.print(a[i]);
if (i < a.length-1)
System.out.print(",");
}
System.out.println("]");


}
static void search(Object[] a, Object n)
{
int where = Arrays.binarySearch(a, n, desc);
if (where < 0)
{
where = -(where + 1);
if (where == a.length)
System.out.println("Append " + n +
" to end of list");
else
System.out.println("Insert " + n +
" before " +
a[where]);
}
else
System.out.println("Found " + n +
" in position " +
where);
}
public static void main(String[] args)
{
// Build Array:
Integer[] array = {new Integer(88),
new Integer(17), new Integer(-10),
new Integer(34), new Integer(27),
new Integer(0), new Integer(-2)};
System.out.println("Before sorting:");
printArray(array);

// Sort:
Arrays.sort(array, desc);
System.out.println("After sorting:");
printArray(array);

// Search:
search(array, new Integer(-10));
search(array, new Integer(-1));
search(array, new Integer(0));
search(array, new Integer(1));
search(array, new Integer(34));
search(array, new Integer(10));
}
}


/* Error:
ArraysTest2.java:8: cannot resolve symbol
symbol : class Descending
location: class ArraysTest2
public static Descending desc = new Descending();
^
ArraysTest2.java:8: cannot resolve symbol
symbol : class Descending
location: class ArraysTest2
public static Descending desc = new Descending();
^
2 errors

*/
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello "r kcy"-

What you have there seems to be a classpath problem, as the "Descending" class is not found. Check that it is present and accessible in your classpath.

But a couple of other points are important as well:

- If you post messages, you should use a meaningful subject line. "Hi, I got a error" communicates nothing about the problem, and will likely lead to people just ignoring your post.
- When you post code, use the Code tag. It's one of the buttons below the message area, and using it leads to code being shown in a more readable, formatted fashion.
- Following the advice given in How to ask meaningful questions will likely lead to more helpful responses to your posts.
- You have been asked twice before to change your display name, here and here. Please fix it prior to your next post, or your account will likely be deleted without a further warning. We take the naming policy serious.
[ December 16, 2005: Message edited by: Ulf Dittmer ]
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ravi,

Your name still does not comply with the JavaRanch naming policy. Please use your first name and your last name, not just "ravi".

The following error message:

ArraysTest2.java:8: cannot resolve symbol
symbol : class Descending


means that the compiler cannot find the class named "Descending". Do you have this class in your source code directory or somewhere else in the classpath?
 
reply
    Bookmark Topic Watch Topic
  • New Topic