I have two classes a Base class and Test class
Base class:
public class Base {
    
    public static WebDriver driver;
    public void browser() {
    System.setProperty("webdriver.chrome.driver", 
     "C:\\Users\\admin\\Desktop\\Selenium\\chromedriver.exe");
    driver  = new ChromeDriver();
    
    driver.manage().window().maximize();
    
    }
And, I am extending my Test classes to the Baseclass to use the driver reference,
public class FacebookTestCase extends Base{
    
    
    public static void main(String[] args ) {
            
        driver.get("www.facebook.com"); 
        driver.findElement(By.id("email")).sendKeys("tetst@test.in");
        driver.findElement(By.id("pass")).sendKeys("test");
        driver.findElement(By.name("login")).click();
        
    }
}
But I am getting Null pointer exception when I run the Test class.
Exception in thread "main" java.lang.NullPointerException at grid.practice.FacebookTestCase.main(FacebookTestCase.java:12)
EDITED
I have another query,
Now I am separating my Test class and Page class and I am calling my page class methods from my test class. I am creating an object of the page class and calling the methods. But I get null pointer exception in the Page class when I pass the driver to the constructor of the page class.
Test class:
public class FacebookTestCase extends Base{
    
    
    public static void main(String[] args ) {
            
    driverInitialization();
    FacebookElements fb = new FacebookElements(driver);
    fb.login();
        
        
    }
Page class:
public class FacebookElements{
    WebDriver driver;
    public FacebookElements(WebDriver driver) {
    this.driver = driver;
    }
    
    
    public void login() {
    driver.findElement(By.id("username")).sendKeys("test");
    driver.findElement(By.id("password")).sendKeys("test");
    }
}
 
     
    