Solved

help on generics

Posted on 2006-10-22
1
224 Views
Last Modified: 2010-03-31
Hi,
    I wrote a class BinaryTreeNode<T> and tried to use it in this declaration: public static int depth(BinaryTreeNode<T> r) {...}  . I got this error:
 cannot find symbol
symbol  : class T
location: class TreeConvert
   public static int depth(BinaryTreeNode<T> r)

why is that? please help . thanks
0
Comment
Question by:azcalv408
1 Comment
 
LVL 9

Accepted Solution

by:
shinobun earned 50 total points
ID: 17785671
You should define your class TreeConvert<T>.

http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Way to decrease size of apk file 9 65
servlet example 11 40
how to install java on RHEL image on EC2 4 26
eclipse console opening separately 2 16
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now