#Class cannot be resolved to Type

85 messages · Page 1 of 1 (latest)

novel pilotBOT
#

This post has been reserved for your question.

Hey @hollow arch! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

hollow arch
#

This is my class for item type

#

yet in my driver code i get ItemType cannot be resolved as type

#

I'm not sure what im doing I haven/t been able to compile this program for hours

#

Been told to try eclipse but that just doesnt work

#

i get this error now

#

        at LinkedListDriver.main(4ysy.java:11)```
#

I think it has something to do with my import packages but im not sure

hollow arch
#

I can send entire code if necessary , really need help with this

obsidian comet
#

filename is 4ysy.java?

#

so class name also is 4ysy ?

hollow arch
#

No i have no idea where thats coming from

#

I tried eclipse by the way

obsidian comet
#

class name can't starts from number

hollow arch
#

yeah i dont have any

obsidian comet
#

at which line the error occurs ?

hollow arch
#

Says 11 which should be the public static void main args line

#

but that makes no sense

#

Do you think i can send all the code? and can you try running it?

obsidian comet
#

sure

hollow arch
#

this is ItemType.java

#

LinkedListDriver.java

#

NodeType.java

#

SortedLinkedList.java

#

And they are all in a folder

obsidian comet
#

at the moment 2 errors

#
  1. import package1.package2.ItemType;
#

are you sure that you do right import?

hollow arch
#

yeah so i read on stack overflow

#

that this error occurs due to bad importation and they said to do this

#

but you can delete that line im not sure what to do tbh

#

whats the other error?

obsidian comet
#

don't follow instructions if you don't understand it. Since I placed all this files in one package, I don't need that line, so I deleted and that error is solved

#

second problem is in LinkedListDriver.java, line 20, ItemType type = new ItemType();

#

you need to pass a argument in the constructor

#

so like ItemType type = new ItemType(5); for example

#

because ItemType doesn't have default constructor

#

(without params)

hollow arch
#

ok yeah delete that line also

#

i read that on stack overflow too

#

cause i was getting ItemType type not resolved error

#

is it compiling now?

obsidian comet
#

yeah

#

but not working, the reason as I mentioned in that another topic

#

nullpointerexception

#

but it compiles

hollow arch
#

wait so how do i fix that null pointer exception

#

and whne you say it compiles does the program say Enter the command?

#

like does it work?

obsidian comet
hollow arch
#

yeah

obsidian comet
hollow arch
#

hmm ok so thats clue

#

a*

#

how would i use a debugger to fix this problem?

obsidian comet
#

and now it works

#

as I deleted that line

#

everything is just fine

hollow arch
#

bro im pretty sure the problem is saving

#

like its not updating my saved file

#

and it keeps giving me the same error no matter what i do

#

maven update or something

obsidian comet
#

use eclipse. Start new project.

hollow arch
#

I did but theres a problem

obsidian comet
#

what problem?

hollow arch
#

can i dm you?

obsidian comet
#

you can, but I can talk 3 more minutes

hollow arch
#

ok

#

if anyone else can help me please do

oak ingot
hollow arch
#

yes

#

nvm ive kinda got it working on my machine

oak ingot
hollow arch
#

idk tbh

#

im lost

#

it works on my machine now though

oak ingot
#

like I see a scanner but not a writer of any kind

hollow arch
#

im just printing the vlaues out

oak ingot
#

but you want to save them to a file correct ?

hollow arch
#

no

#

i was talking about my changes to the file itself

#

ive got it working now though

oak ingot
#

oh ok

hollow arch
#

tysm