Can we use predefined Class/Interface name as Identifier?
class Identifier8
{
public static void main(String alt[])
{
int System=20;
System.out.println(System);
}
}
/*
O/P:- Complitation Error
Explanation :- Once any predefined class/interface name is behaving like a variable
then that identifier can only behave like a variable and cannot be used
as a class/interface name. In line 7 System is behaving like a class name.
*/
{
public static void main(String alt[])
{
int System=20;
System.out.println(System);
}
}
/*
O/P:- Complitation Error
Explanation :- Once any predefined class/interface name is behaving like a variable
then that identifier can only behave like a variable and cannot be used
as a class/interface name. In line 7 System is behaving like a class name.
*/
0 comments: