There is a problem with the Java inherited generic type

topic description

Hello, everyone. I try to use inheritance and generics to make a proportional series, but the proxy framed next to the color line does not match Long. I changed the long in the protected long nextValue () method to Long, but this does not match. There are also some problems with the change. there will be problems with whether or not to change it. I would like to thank the gods, where is the fault in the end? I need you to be busy with QAQ tips

.

related codes

import java.util.*;
import java.lang.*;

public class ProgressionGeneric <k> {
protected k a;
protected k b;
ProgressionGeneric(){a=b;};
protected k firstValue (){b=a;
return b;};
protected k nextValue(){return b;};
protected void printProgression(int n){
    k cc=nextValue();
    System.out.print(cc+" ");  
    for(int i=1;i<n;iPP){
        k c=nextValue();
       System.out.print(c+" ");    
    }
    }; 
public class GeomProgression extends ProgressionGeneric<Long>{
protected long r;

GeomProgression(){ //first =1, r =1 by default
 this(1,1); //first = 1; r = 1;
}
GeomProgression(long a, long base) { //Set r to base
a = a;
 r = base;
}

protected long nextValue(){
long b=a;
 b *= r; //cur = cur*r;
return b;
}
}
public class Main {
public static void main(String[] args) {
    GeomProgression gogo =new GeomProgression(1,4);
    gogo.printProgression(3);
}


Jul.25,2021

modify your program after uploading it to IDE. After changing the return value type of nextValue to Long, there is no problem that the output type does not match.
instead, I read the NullPointerException, account while running. The reason is that the builder of GeomProgression is here, and
you transfer the parameter a value to the data member an inherited from ProgressionGeneric. However, because the two parameters are all named a, the editor can not distinguish between the data members an and the data member a. however, because the two parameters are all named a, the editor is not able to distinguish the data member a from the data member a from the data member a, however, because the two parameters are all named a, the editor is not able to distinguish the data member a from the data member a, however, the editor can not distinguish between the two parameters
so this value operation is invalid. The value of
an is equivalent to null (as to why it is not 0, because it is not a basic long, but Long, is set to null if it does not specify a value)
programs will emit NPE, when running.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3aaf1-2c214.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3aaf1-2c214.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?