у меня есть два файла типа java class
package com.company;
public class Vector3 {
private double x;
private double y;
private double z;
public Vector3(){
x = 0;
y = 0;
z = 0;
}
public Vector3(double x, double y, double z){
this.x = x;
this.y = y;
this.z = z;
}
public void setX(double x){
this.x = x;
}
public void setY(double y){
this.y = y;
}
public void setZ(double z){
this.z = z;
}
public double getX(){
return x;
}
public double getY(){
return y;
}
public double getZ(){
return z;
}
public double lenghtVector(){
return Math.sqrt((x*x+y*y+z*z));
}
public double scalarProduct(Vector3 v2){
return (this.x*v2.x+this.y*v2.y+this.z*v2.z);
}
public double getAngle(Vector3 v2){
double numerator = this.x*v2.x+this.y*v2.y;
double denominator = (Math.sqrt(this.x*this.x+this.y*this.y)*Math.sqrt(v2.x*v2.x+v2.y*v2.y));
return numerator/denominator;
}
public void info(){
System.out.println("x="+this.x+" y="+this.y+" z="+this.z);
}
public Vector3 vectorProduct(Vector3 v2){
Vector3 v3 = new Vector3();
v3.x = this.y*v2.z-this.z*v2.y;
v3.y = this.z*v2.x-this.x*v2.z;
v3.z = this.x*v2.y-this.y*v2.x;
return v3;
}
public Vector3 plus(Vector3 v2){
Vector3 v3 = new Vector3();
v3.x = this.x + v2.x;
v3.y = this.y + v2.y;
v3.z = this.z + v2.z;
return v3;
}
public Vector3 minus(Vector3 v2){
Vector3 v3 = new Vector3();
v3.x = this.x - v2.x;
v3.y = this.y - v2.y;
v3.z = this.z - v2.z;
return v3;
}
public static Vector3[] arrayVector(int N){
Vector3[] result = new Vector3[N];
for (int i=0; i<N; i++ ){
result[i] = new Vector3(i,i,i);
}
return result;
}
}
и второй
package com.company;
public class Class {
public static void main(String[] args) {
Vector3 v1 = new Vector3(4,5,6);
Vector3 v2 = new Vector3(1,2,3);
Vector3 v3 = v2.plus(v1);
v3.info();
Vector3[] arrayVector = Vector3.arrayVector(5);
for (int i=0; i<5; i++ ){
arrayVector[i].info();
}
}
}
при компиляции выдает ошибку
"C:\Program Files\Java\jdk-16.0.1\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.1.1\lib\idea_rt.jar=52092:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.1.1\bin" -Dfile.encoding=UTF-8 -classpath C:\java\untitled\out\production\untitled com.company.Main
Error: Could not find or load main class com.company.Main
Caused by: java.lang.ClassNotFoundException: com.company.Main
Process finished with exit code 1
в jave пару дней только учусь, так что не судите строго.