Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!

Gourav Das

Ranch Hand
+ Follow
since Mar 17, 2020
Hi , I am a Java Developer. You can contact me for personal projects or any other help.
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
1
Total given
28
Given in last 30 days
3
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gourav Das

No sir , i have passed the name parameter via the url , check the code , if i remove the Integer.parseInt() part the code runs successfully on my tomcat server. So its for sure that name is ="2" , but i dont understand whats the problem converting it to integer
1 week ago

Dave Tolls wrote:When you first go to that JSP page what will the value of "name" be?

That's the answer to your question.

A key thing, though, i that that Java code should not be in a JSP page.
Indeed the JSP page should not be accessible directly from the browser.  You should be going via a servlet.



I agree java code should not be in jsp page , but my question was why when converting to integer  it threw NumberFromatException.

"name" must store "2" as a string when clicked on the button called "Get".
But when i tried converting the string "2" into integer value it threw error , i dont understand. :(
1 week ago
So i was trying to pass a javascript variable value to jsp by using request.getParameter() , but it throws numberformatexception when i try to convert it to integer

I donot understand the cause of the error in this simple program




The error log is down here:



1 week ago
So i was trying to pass a javascript variable value to jsp by using request.getParameter() , but it throws numberformatexception when i try to convert it to integer

I donot understand the cause of the error in this simple program




The error log is down here:



1 week ago

Rob Spoor wrote:Java looks at the declared type, not the actual type, when determining which methods can be called. The declared type is not your anonymous inner class' type, but Main. Since that has no init method, you can't call it.



I donot understand , please give some reference , why can't it call the anonymous class function?
1 week ago
Its very strange that anonymous class functions cannot be called from main. Why is that?

as you can see i get error when i try to call "app.init();"

1 week ago

Tim Moores wrote:Which error? The code is supposed to print out a string of text, and it apparently does exactly that.



The error java.lang.AbstractMethodError , how to fix this error?
3 weeks ago
Please help me why am i getting this error?









This is the code
3 weeks ago
When we print the array object of char data type it prints out the characters in the array..

When we print the array object of byte data type it prints out some jiberrish kind of stuff.... why so? Any explanation?






Printing this

3 weeks ago
Kindly notice that this.taxcode.compareTo(o.taxcode) is what?

fist of all , this -> this is the object of the persone class,.
this.taxcode-> so the object of the person class calls the object of the String class
this.taxocde.compareTo(o.taxcode)->the object of the person class calls the object of the String class which inturn calls the pre-defined function compareTo() of the String class and compares the value of the string assigned by this object to taxcode to the string assigned by o object to taxcode.. 'o' object is also a Peron class object
3 weeks ago
I am trying to encode the byte array into a string with encoding format of Big5 which is Chinese , but it shows result as CDEFG , why can i not see chinese?

Please help!!

3 weeks ago
This is the question..



Consider the following generic interface definitions.
/∗∗
∗ Generic interface which defines an <code>apply</code> method which applies a task to its argument.
∗/
public interface Task<T> {
/∗∗
∗ Apply this instance's task to an object argument.
∗ @param object The object to which this task is applied.
∗/
public void apply( final T object );
}
/∗∗
∗ Generic interface for collections which allows for a traversal of the members of the collection
∗ and applying a task to each member of the collection.
∗/
public interface Traversable<T> extends Iterable<T> {
/∗∗
∗ Apply a task to each member of this <code>Iterable</code> collection.
∗ @param task The task which is applied to each individual member
∗ of this <code>Iterable</code> collection.
∗/
public void traverse( final Task<T> task );
}


Using the Task interface you may define a polymorphic Task object whose instance method apply( ) applies a task to an object reference argument.
E.g. consider the (polymorphic) Task objects print1 and print2.
Assume that the apply( ) method of the print1 object prints its argument once and that the apply( ) method of the print2 object prints its argument twice. Then print1.apply( object ) prints object once and print2.apply( object ) prints object twice.
The Traversable interface lets you define a polymorphic Traversable object which can traverse all members of an Iterable collection and apply a given task to each member of the collection.
Furthermore, assume we have a Traversable object traverser which visits all objects in a list. Then traverser.traverse( task1 ) prints each object in the list once and traverser.traverse( task2 ) prints each object in the list twice.
For this question you will implement a concrete class which implements the Traversable interface. The name of the class should be Traverser. The class should have a constructor which takes one parameter, which should be a Iterable object reference whose members are traversed by the instance method traverse( ) of the Traverser interface. You should be able to guess the signature of the constructors.



so Far i have created the class Traverser which is




The interface Trasversable




The interface Task





What am i supposed to do now according to the question i cannot figure out... please guys help me
1 month ago
Yes i have changed it to text , please help me Sir.
1 month ago
Okay Sir , i am trying to do it
1 month ago
I cannot understand this question , can someone help me out or write a template code for it?

Please i need help Sir//  


The Question is this:



Implement a non-generic class called NonGenericPair. Instances of the class should consist of two object
references. The class should define getters, setters, and two constructors. Instances of the class should be capable
of comparing themselves for equality with other object references using the equals( ) method. Instances should be
able to convert themselves to String; the result of such conversions should clearly show the two object references
which are owned by the instances.
1 month ago