Type:… Always be resolved.
Reason analysis:
:
/* Any hint that… Always be resolved.
* 1. Variables are used without being declared or defined.
* 2. Some class, no import or definition
* 3. An object that is not defined or declared.
*
*
*/
Examples in specific projects:
import java.util.Scanner;
public class AppCAC
{
public static int Avg(int temp)
{
int avg1;
avg1=temp; // When written like this: avg1=temp; The error shown is: AvG1 cannot be Resolved // i.e. Avg1 cannot be resolved.
avg1=avg1+temp;
return avg1;
}
public static int Max(int temp)
{
int M=0;
if(temp> =M)
M=temp;
return M;
}
public static int Min(int temp)
{
int Min=0;
if(Min> =temp)
{
Min=temp;
}
return Min;
}
public static void main(String[] args)
{
int com;
int avg;
int max;
int min;
// here I want to define three methods
// how do I define methods?
/*Scanner scan=new Scanner(system.in); Multiple markers at this line
-scanner cannot be resolved to
a type*/
for(int I =1; i< 11. I++)
{
system.out.println (” please enter: “);
// com=scan.nextInt(); I can conclude by saying:
/* any scan cannot be resolved. Always be resolved.
* 1. Variables are used without being declared or defined.
* 2. Some class, no import or definition
* 3. An object that is not defined or declared.
*
*
*/
Avg(com);
Max(com);
Min(com);
}
/*for(i=1; i< 11. I++)
{
system.out.println (” please enter: “);
com=scan.nextInt();
Avg (com);
Max(com);
Min(com);
}
, this code shows: Multiple markers at this line
-i cannot be
-i cannot be
resolved
-i cannot be
resolved
this error, : error: I cannot be processed. Why can’t I be processed??The reason: I use it without defining I, and variables can only be used if they are defined.
*
*/
avg=Avg/10;
system.out.println (” now start output: \n”);
system.out.println (” mean: “,avg);
system.out.println (” Max: “,Max); // The method println(int) is not applicable for The arguments (String, int),
// learn how to use println method.
}
}
Read More:
- Ternary operator in Java?: error: not a statement
- Java — for loop printing graphics (loop structure)
- Java: How to Find the Minimum Value from a Random Array by Bubble Sort Method
- Abstract method and static method of java interface
- How to convert a Java string into a number (stringtonumber)
- Explicit and implicit conversion of Java data type
- Java Error: No enclosing instance of type Main is accessible. Must qualify the allocation with an encl
- JAVA: How to use the third-party font library method (using the third-party TTF / TTC font library method)
- Mongodb java version 3.X, prompt “XXX (an encryption algorithm) is not available” when there is a user name and password
- Asynchronous callback case of Java callback function
- Java callback function implementation case
- Initializingbean Interface & Applicationcontextaware Interface in Springboot
- Springboot controls the startup of rabbitmq through configuration files
- JAVA 8: How to Convert List to Map
- Redis: How to Implementate LRU Caching Mechanism Manually
- Java uses single thread pool to realize multi thread sequential execution (non alternating, non synchronous)
- JAVA: Random access file is always garbled
- Extracting JDBC tool class: JDBC utils
- Three ways of thread sequence alternate execution in Java lock free programming
- Java error: unable to find or load main class (package name in source file)