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:
- [Solved] Annotation Customize Error: ElementType cannot be resolved to a variable
- Java learning unreported exception java.io.IOException ; must be caught or declared to be thrown
- Mongodb java version 3.X, prompt “XXX (an encryption algorithm) is not available” when there is a user name and password
- The java springboot websocket service server actively closes the connection and causes java.io.EOFException to be thrown
- [Solved] Java.util.linkedhashmap cannot be cast to entity class
- [Solved] Java.lang.ClassCastException: [Ljava.lang.Long; cannot be cast to java.util.List
- [How to Solve Error]java.util.Date cannot be cast to java.sql.Date
- Java parsing xml file encounters special symbols & will be abnormal solutions
- [Solved] No validator could be found for constraint ‘javax.validation.constraints.NotBlank’ validating type ‘java.lang.String’
- [Solved] Flyway Error: Detected applied migration not resolved locally:2 and the execution script error
- [Solved] Mybatis insert Error: Cause: java.sql.SQLException: SQL String cannot be empty
- Java uses class array to report error Exception in thread “main” java.lang.NullPointerException solution
- [Solved] SpringCloud Compile Error: java: JPS incremental annotation processing is disabled. Compilation results on partial recompilation may be inaccurate.
- [Solved] Hibernate Error: java.lang.StackOverflowError at java.lang.Integer.toString(Integer.java:402)
- Ternary operator in Java?: error: not a statement
- Java error: java.lang.NoSuchMethodError
- [Solved] Java 9 reflection error: java.lang.reflect.InaccessibleObjectException
- [Solved] Kafka in Windows error:java. nio. file. Filesystemexception: this file is in use by another program and cannot be accessed by the process
- 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