I'm trying to write a recursive method that will print a char c, x amount of times on the same line. I was thinking that I could return the recursive function call and concatenate the char c but I don't think my compiler agrees. What exactly are the properties of chars and how can I go about doing this?

Recommended Answers

All 7 Replies

What is your code

extend the char ,make it a object

extend the char ,make it a object

Cannot extend char (Character class). It is final.

Can't you just store the values on a String and then accept a value for the count of recursion. Call the method passing the String and Integer.

If you must use a char data type, then is a simple typecasting.

I mean the superclass of the char .Or can extend other original data type , give it more function

>I mean the superclass of the char .Or can extend other original data type ,
>give it more function
Why do you want to bother doing all that stuff? When a simple typecasting is enough.

Yeah ,I feel like I always want to exten sth ,Isn't stupid ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.