Please explain this class | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Please explain this class

Here is the token class. Please explain every line in detail hopefully hopefully it will solve my big trouble https://code.sololearn.com/c0IZmQSgmV1s/?ref=app

1st May 2020, 11:21 AM
Komal Ramzan
Komal Ramzan - avatar
12 Answers
+ 7
Every 81 lines of this code to be explained in details: are you kiding? :o You'll be better adviced to make a google search about tokenization and code languages parsing and read many articles/ressources about, because this is a wide and deep topic... also, you should have a minimal Java (or other language if not) practice background to understand both the code itself and the principles ;)
1st May 2020, 5:51 PM
visph
visph - avatar
+ 5
Denise Roßberg sure it will thank u😊
1st May 2020, 11:20 PM
Komal Ramzan
Komal Ramzan - avatar
+ 4
Komal Ramzan To explain every line would be a bit hard. ;) But maybe this code helps you to understand the overriden methods: https://code.sololearn.com/cK2H7CdVEq45/?ref=app
1st May 2020, 6:48 PM
Denise Roßberg
Denise Roßberg - avatar
+ 4
Denise Roßberg i have knowledge about java n its basic concepts but my assignment is based on this class and i am using this type of class first time so there is confusion any ways i will search related topics on google☺
1st May 2020, 11:56 PM
Komal Ramzan
Komal Ramzan - avatar
+ 3
visph of course i am not kidding🙄
1st May 2020, 11:23 PM
Komal Ramzan
Komal Ramzan - avatar
+ 2
notice Token class override nothing
1st May 2020, 7:26 PM
zemiak
+ 2
zemiak The class overrides equals(), hashCode() and toString(). Edit: I did not test the class so I am not sure if the implementations are correct.
1st May 2020, 7:29 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
Komal Ramzan The rest should be found in the java course. You will need the lesson about enums. The lesson about constructor: public Classname() is a constructor for example: public Token() You have three. If I am correct there is only a lesson about method overloading but not constructor overloading. But it is similar. Then you just need to read the lesson about methods.
1st May 2020, 11:48 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
there are different ways how to create Token: new Token(10.0); with number, as OPERAND, precedence 0 new Token("+"); with string, as OPERATOR, precedence 0(+-) or 2(*/) new Token("("); with string, as PAREN, precedence -1 new Token(token1); with other token
1st May 2020, 12:58 PM
zemiak
- 5
hii
3rd May 2020, 6:49 AM
Rakshanda Kamil
Rakshanda Kamil - avatar
- 6
,e
2nd May 2020, 8:52 PM
Mario Soto
Mario Soto - avatar
- 6
Hi
2nd May 2020, 9:54 PM
Fahem Chegra
Fahem Chegra - avatar