Hi I have this problem I get this error in the main function: "non static method cannot be referenced from a static context" all of the methods called are underlined with this error. I've tried a few things and I can't find a way to overcome it and it's doing my head in. Is there a way I can get rid of that error? thanks here is the code:  import java.util.Scanner;  public class Survey {  int age; char gender; char show; int over30MY = 0, over30FY = 0, under30MY = 0, under30FY = 0; int over30MN = 0, over30FN = 0, under30MN = 0, under30FN = 0; int totalCalls; int totalWatchers; float perTotalWatchers; float perU30M, perU30F, perO30M, perO30F, perTotalF, perTotalM; float perTotalU30, perTotalO30, perTotal;  public static void main(String[] args) {             System.out.println("Thank you for your call,\nPlease take some time to answer a few questions");     Info();     collectData();     getTotals();     printTotals();  }//end of main  public void Info() { //Prints student Info      System.out.println("");     System.out.println("");     System.out.println("");     System.out.println("");     System.out.println(""); }  public void collectData() {      Scanner userInput = new Scanner(System.in); //Does everything      //ask questions     System.out.println("What is your age?\n");     age = userInput.nextInt();      System.out.println("Male or Female (Enter M or Y)");     gender = userInput.next().charAt(0);     gender = Character.toLowerCase(gender);      System.out.println("Do you watch the show regularly? (Enter Y or N)");     show = userInput.next().charAt(0);     show = Character.toLowerCase(show);      //store data     if((age &gt; 30) &amp;&amp; (gender == 'm') &amp;&amp; (show == 'y')) {                over30MY++;                  }     else if((age &gt; 30) &amp;&amp; (gender == 'f') &amp;&amp; (show == 'y')) {         over30FY++;     }     else if((age &lt; 30) &amp;&amp; (gender == 'm') &amp;&amp; (show == 'y')) {         under30MY++;     }     else if((age &lt; 30) &amp;&amp; (gender == 'f') &amp;&amp; (show == 'y')) {         under30FY++;     }     else if((age &gt; 30) &amp;&amp; (gender == 'm') &amp;&amp; (show == 'n')) {         over30MN++;     }     else if((age &gt; 30) &amp;&amp; (gender == 'f') &amp;&amp; (show == 'n')) {         over30FN++;     }     else if((age &lt; 30) &amp;&amp; (gender == 'm') &amp;&amp; (show == 'n')) {         under30MN++;     }     else if((age &lt; 30) &amp;&amp; (gender == 'f') &amp;&amp; (show == 'n')) {         under30FN++;      }//end of if else  }//end of collectData      public void getTotals() {//calculate totals for printing          totalCalls = over30MY + over30FY + under30MY + under30FY + over30MN + over30FN +      under30MN + under30FN;          totalWatchers = over30MY + over30FY + under30MY + under30MN;          perTotalWatchers = Math.round(totalWatchers / totalCalls); //rounds percentage to nearest whole number          perU30F = Math.round(under30FY / totalWatchers); //Total Under 30 Females         perU30M = Math.round(under30MY / totalWatchers); //Total Under 30 Males         perO30F = Math.round(over30FY / totalWatchers); //Total Over 30 Females         perO30M = Math.round(over30MY / totalWatchers); //Total Over 30 Males          perTotalF = Math.round(perU30F + perO30F); //Total Females         perTotalM = Math.round(perU30M + perO30M); //Total Males          perTotalU30 = Math.round(perU30F + perU30M); //Total Under 30         perTotalO30 = Math.round(perO30F + perO30M); //Total Over 30         perTotal = Math.round(perTotalF + perTotalM); //Total       }//end of getTotals      public void printTotals () { //Prints the Totals          System.out.println("Total People called is "+totalCalls);         System.out.println("Number of people who watch the show regularly is "+totalWatchers);         System.out.println("Percentage of those who watch the show is "+perTotalWatchers);                System.out.println("");         System.out.println("");      }//end of printTotals  }// end of class
The very common beginner mistake is when you try to use a class property "statically" without making an instance of that class. It leaves you with the mentioned error message:     You can either make the non static method static or make an instance of that class to use its properties.   Why? I am not asking for solutions. I would be grateful to know what is the reason behind it. The very core reason!  private java.util.List&lt;String&gt; someMethod(){     /* Some Code */     return someList;             }  public static void main(String[] strArgs){                // The following statement causes the error. You know why..     java.util.List&lt;String&gt; someList = someMethod();          }
How can I ask a person in which order in his family among the siblings? My colleague he have two brothers. I want to know, he is first/second/third son of his parents, ie., the order in the family among their siblings.  I can simply ask     Are you first son of your family?   It simply give some predictions, I don't want to that.  Is there a better way to ask the question? Why AUC =1 even classifier has misclassified half of the samples? Run multiple instance of a program in parallel Vertical space in lists What does the "private" modifier do? Considering "private" is the default access modifier for class Members, why is the keyword even needed? It is a theorem in elementary number theory that if $p$ is a prime and congruent to 1 mod 4, then it is the sum of two squares. Apparently there is a trick involving arithmetic in the gaussian integers that lets you prove this quickly. Can anyone explain it? What are the assumptions for applying a quantile regression model? The question has been asked (one time) on CV before, but the answer is really imprecise and does not really answer the question in my opinion.  So: What are the assumptions for estimating a linear regression model via quantile regression?  To my understanding (and as several CV users have mentioned), quantile regression does not assume any specific distribution of the error terms - does that mean that, in a time series model, autocorrelation and heteroscedasticity do not have to be accounted for?  What about the other Gauss-Markov assumptions? I would assume that the assumption of no perfect multicollinearity has to be met when applying quantile regression, but do the parameters have to be linear? The linearity assumption only has to hold for the specific quantile I would assume.  Anyways - I do not find any backup for any of my thoughts in the scientific literature and I would appreciate a comprehensive answer. Thank you! Bootstrap dropdown sub menu missing Is there an alternative to DVD-Shrink, that can compress a DVD image to a smaller size to fit on a writeable DVD? Is there a linux alternative to the Windows application DVD-Shrink, that can compress a DVD image to a smaller size to fit on a writeable DVD?  In backing up some DVD's the ripped ISO file size is over 7000MB is there an alternative linux software, similar to Windows "DVD Shrink" that can compress this to fit on a writeable DVD which is about 4000MB Adding popup message box before tool execution with ArcPy and ArcMap I want to add a box message to pop up before execution of a button tool. When I click a button which will do geoprocessing, I want a box to appear on view before processing with message that I am about to do xxx processing. How do I do it? What does "--" (double-dash) mean? I have seen -- used in the compgen command.  For example:  compgen -W "foo bar baz" -- b   What is the meaning of the -- in there? Unable to shrink transaction log file in SQL Server I moved to a new company recently wherein they have 2 databases in a SQL server of size 20-25 GB. I'm unable to shrink the log file of the databases. Transaction log backup of the databases are set to run every 30 mins from 6 AM-7PM. They are of size 10 and 2 Gb respectively. I tried to shrink it around 8-9 PM last night but I was not able to do.  The log_reuse_wait column stated it's waiting on a log_backup. I tried taking couple of log backups which didn't help. I ran DBCC OPENTRAN but there are no open transactions.  Also, this morning even after the Tlog backups started at 6:00 AM till now(10:30) it still shows LOG_BACKUP in log_reuse_wait column. And no OPEN TRAN as well.  When I researched on this I found this article from Paul Randal:   It states that if the DB is small and all the content of tlog file is in same VLF it couldn't truncate. I have some 300-400 VLFs in the Databases. So that doesn't make sense here as well.   One thing I noticed that every morning at 6 AM the tlog is a little bigger than the other ones. So I'm thinking to check with the lead DBA to run tlog round the clock. Other than that, I would like to see why is this happening and Am i missing anything.  I tried to shrink with the below command:  Use DB1 go DBCC SHRINKFILE(2,10)  GO   Note: It's SQL 2012 instance running 0n 2012 compatibility Convert binary to ASCII and vice versa Why is \[ ... \] preferable to $$ ... $$? Pass in an array of Deferreds to $.when() What are the Windows A: and B: drives used for? In Windows you have a C-drive. Everything labeled beyond that is with the following letter.   So your second drive is D, your DVD is E and if you put in a USB stick it becomes F and the following drive G. And so on and so forth.  But then, what and where are A and B-drives? I think I have found the final answer $\left(4 \left[\frac{2t \cosh(4t) - \sinh(4t)}{t^2}\right]\right)$ but need to verify it. I am running Ubuntu 15.10 with Gnome DE.  I installed KDE plasma to try it out but sudo apt-get upgrade started giving me errors so I ppa-purged the kde ppa and removed kubuntu desktop with the terminal in Gnome.  Now when I run sudo apt-get upgrade , I get the following error:    The following packages have unmet dependencies:     kde-telepathy-minimal : Depends: kde-config-telepathy-accounts      (&gt;= 15.04.0) but it is not installed.   sudo apt-get install -f does not resolve the issue. I tried sudo apt-get remove kde-telepathy-minimal to remove the package which gives me this error:    The following packages have unmet dependencies: kde-telepathy : Depends: kde-telepathy-minimal   Attempting to remove 'kde-telepathy' gives me the original error.  I am stuck. Please help me and thank you Ubuntu community! Generating ordered combination of numbers I can form numbers with only 0,2,4,6,8.  The sequence is as follows  0,2,4,6,8,20,22,24,26,28,40,42,.....  How to generate an ordered sequence of numbers from combinations of 0,2,4,6,8. Is abstract algebra (mostly?) restricted to $2$-ary operators? This may be due to my own pure ignorance but it's my experience that all abstract algebra I've been introduced to, both in actual courses and in self-studies only exclusively deals with algebraic objects consisting of a set together with one or more binary operators defined on that set, perhaps over some other algebraic structure. Not counting categories here, just "low-level"-ish stuff.  I'm an undergraduate so my knowledge is of course very limited but I can't help to wonder why I never stumble upon algebraic structures with $n$-ary operators? Is there a good reason for this, something along the lines of $n$-ary operators behave "badly" when $n&gt;2$ or is it just my ignorance because I'm a beginner in the field?