Operator Part 2
** Do while loops execute at least once
**FOR Loop(condition is checked everytime , increment after first iteration)
for(Integer year = 1100; year<1101; year++)
{
System.debug('YES' );
}
---
**Yes, in Apex, the == operator can compare strings. When using == with strings in Apex, it checks for value equality, meaning it compares the actual content of the strings, not their memory reference.
public access modifier (or any other access modifier like private, protected, or global) inside a method in Apex. Access modifiers are only allowed at the class or class member level (i.e., for instance variables, static variables, or methods).**Can we have 2 methods wth same and name and signature but different returntype in an apex class ?
Apex, like Java, does not support method overloading by return type alone. When calling a method, the compiler looks at the method name and parameters to determine which method to execute. Since the return type is not part of this decision process, having two methods with the same name and parameters but different return types would create ambiguity for the compiler.
**You cannot call static variables from a class instance in Apex
Although Java will allow you to reference a static variable from an instance, it is considered bad practice. The correct way is to access static variables via the class name.
**You cannot use Non Static variables within a static method
**Apex is CaseInsensitive unlike Java
** this instance always refer to class instance (ex this.abc)
**Constructor call this() OR this(abc)
** Static blocks..then Initilization Blocks ...then Constructor is called
**Inner class used when it is supposed to be used only by that class for example We create a Company Class and then Customer Class as Inner Class .
**Annotattions like @InvocableMethod allows methods to be accessable from ProcessBuilder
**A test method can only be public or Global nothing else like private and protected (@isTest both in class and methods)
Comments
Post a Comment