+ 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

9th Aug 2018, 10:12 AM
Nimr Sawafta
Nimr Sawafta - avatar
5 Antworten
+ 3
sure , i would love to work with someone like you in a futuer projects 😊
9th Aug 2018, 12:38 PM
Nimr Sawafta
Nimr Sawafta - avatar
+ 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
9th Aug 2018, 10:26 AM
StealthyTaco
StealthyTaco - avatar
+ 1
ive change it to static and put the main code in the class itself and it did work
9th Aug 2018, 10:29 AM
Nimr Sawafta
Nimr Sawafta - avatar
+ 1
but the first error that i didnt know why , Thanks robert
9th Aug 2018, 10:30 AM
Nimr Sawafta
Nimr Sawafta - avatar
+ 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
9th Aug 2018, 10:33 AM
StealthyTaco
StealthyTaco - avatar