Zulfi Khan

Ranch Hand
+ Follow
since Jun 05, 2016
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
20
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Zulfi Khan

Hi,
Thanks. I solved this problem. So tail was not null just because of line#49

Zulfi.
6 months ago
Hi,
<It's pretty clear that the variable tail must be null at line 49, isn't it? So that would be your problem.>
I have solved that null problem but still its not printing correct values of head.id and head.name in displayFromHead(). My modified code for  DLLAddtoTail is:





My recommendation is to learn to use a debugger.  Step through the code, see what's happening as opposed to what you think is happening.



Debugger is not straight forward. I tried to learn that several times but I got problem with break point. I posted on this forum also but did not get help.

Somebody please correct my code.


Zulfi.
6 months ago
Hi,

My modified code is:

6 months ago
Hi,
You are right. I am getting "Null pointer Exception" in main if I print head.

I have even declared it as static but the error is still coming.


Exception in thread "main" java.lang.NullPointerException
at dlladdtotail.DLLAddtoTail.main(DLLAddtoTail.java:38)
C:\Users\zulfi\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 7 seconds)





Somebody please guide me.

Zulfi.
6 months ago
Hi,
I am uploading the image.

6 months ago
Hi,
Thanks for your response.

<Because you set head to null at line 16.>

That was the initialization which I did again in line#28.

But why the assignment in line#34 not working?

Some body please guide me.

Zulfi.
6 months ago
Hi,
Thanks for your response. I have initialized tail to head in line 48:
i.e.



So why its null?

Some body please guide  me.

Zulfi.
6 months ago
Hi,
I am creating a doubly linked list but I can't traverse it. I am not getting any but the contral is not entering the while loop.



Some body please guide me what's the problem. I am using Netbeans 8.1 and I am working on Windows 10.

It is displaying :



Testing1



in JOptionPaneDialog(...)

Zulfi.
6 months ago
Hi,
<Sounds like an editor issue, not a Java issue.>
I think you are right. B/c I remember doing this on notepad with jdk and it worked.

Zulfi.
6 months ago
<Does it reach out with a stick and hit you on the hand so you can't type that?>
Sorry! Maybe it happens with yourself.

Mine is a weaker one so it bangs. Yes I got  windows sound due to excessive key pressing. I can't delete the "String" word  within the angle brackets using my backspace key.

Zulfi.

 
6 months ago
Hi,
I am using Netbeans 8.1. I created a ComboBox component. It shows me “String” as its data type.


I tried to delete the String & change it to Integer, but NetBeans is not allowing me to do so. Please guide me how can I store Userdefined objects or Integer objects in ComboBo using Netbeans?

Zulfi.
6 months ago
Hi,
I have a problem with discussing about the terms Generic & Collection. Both are used to define classes like ComboBox. So we can say that ComboBox is a generic class and also a Collection class (Right or Wrong?) Are the terms generic and Collection same?
Other thing is that:
Collection: means that there is no limit to the size of ComboBox class (Right or Wrong?), i.e we store infinite elements in it  (is this correct in the context of Generic)
Generic: ComboBox is generic because we can store any type of object in ComboBox but this is wrong when we create a Combobox then Netbeans shows that it can only store Strings like:



Some body please guide me.

Zulfi.
6 months ago
Hi,
Thanks for providing solution to this problem.

Operator precedence seems to be right a answer. However the truth is that I did not grasp the other answer.

Believe me I realized this answer sometime back but I could not post my clarification on this.

Sorry, side question, Zulfi: why are you coding a different method for each math operation?
Okay i would try it using switch-case but in case of event driven programming, handler function is a easy option.

Good team work.

God bless you guys.

Zulfi.
6 months ago
Hi,
Thanks all for your responses.

Actually the same thing works for Multiply and divide. If its the question of "String conversion" then why its not doing on Multiply & divide.


Is this a specialized behavior towards "subtract" operator?

Zulfi.
6 months ago
Hi,
I am trying to subtract two integers in Java. I am using NetBeans 8.1. I am first reading the integers from text field. Then converting them into integer. Then I am subtracting them But I am getting error:

     
bad operand types for binary operator '-'
first type: String
second type: int



I have written the following code:



Somebody please guide me how to solve this problem.

Zulfi.
6 months ago