+ 1
Problem with a function call in java
How we call the public class from outside the class Ive triad writing Class NAM{ Public int name(int x){ Some codes; } } Static void main (String [] args ){ NAM SS = new NAM(); SS= NAM.name(6); } Error message
5 odpowiedzi
+ 3
sure , i would love to work with someone like you in a futuer projects 😊
+ 1
could you provide a link to your code? from what i see here,
Class needs to be class
Static needs to be static
and when you call the name method in the main method just do
SS.name(6)
SS Is your NAM object and has access to all the member variables you define within the class
+ 1
ive change it to static and put the main code in the class itself and it did work
+ 1
but the first error that i didnt know why ,
Thanks robert
+ 1
Nimr Sawafta anytime feel free to tag me in your posts if you ever have any java related questions :) id be happy to help