+ 2
What is mean
Return color[(int)(math.Random()star color.Lebgth) ]
10 Answers
+ 8
there are many syntax errors in this code but i assume from what i am seeing that you have an array of colors and you generate a random index in the array in order to get a random color
+ 6
interesting example
seems like a logging class for logging different types of messages types, represented by numbers 1,2,3 with hierarchy of INFO (1) being the lowest, DEBUG (2) is the middle and ERROR (3) being the highest level.
each time a message is logged, it calls the lower level to also log the same message (as can be seen in the output example)
step 1:
declaring a base class as abstract (meaning you cannot create instances of it as in "new AbstractLogger" and must extend it with a subclass)
the method setNextLogger and logMessage will be shared among all instances of subclasses of this class
step 2:
decleration of 3 subclasses which extends AbstractLogger
nothing much to see in here, just 3 classes which behave practically the same
step 3:
the class in the file is merely for demostration purposes
noteworthy points:
getChainOfLoggers() methods return value is errorLogger while the method created and initialized 3 types of loggers o_O
the reason behind that is related to the fact this is a chain reaction and errorLogger essentially contains all the loggers within it
from there it's merely passing the appropriate flag to the logMessage method (which originally resides in the AbstractLogger class) and from there each individual overriden method is called in the appropriate class (ConsoleLogger, ErrorLogger,FileLogger)
fin
+ 5
color.length is a propery of an array
and will return the number of elements in the array
+ 5
sb seems like a class method and b seems like an object of class a
if you have more detailed code it would be more helpful
0
Thanks
i need exactly what mean is this
color.length
0
Hi again i Have a qoastion If we Have a class for EX a
What are b and sb? In this sentences
Protected a b;
Public void sb(a b) {
This.b=b;
}
i think b is abject from a class and sb is function but i cant understand what they work? What is that sentence mean?
Thanks for your help
0
Im try understand this code in this page
https://www.tutorialspoint.com/design_pattern/chain_of_responsibility_pattern.htm
0
Can you description to me step 1 and void main
0
Baby where are you?
0
Ooh thanks you really help me honey ✌️✌️✌️😘😘😘😘😍😍😍😍