[Solved] Access a variable across multiple classes JAVA

Sure this is possible 😀 There are many ways to do so. For example you can easily do this: //Obviously pseudo Code…u need a constructor..or method Public Class A{ Scanner input = new Scanner(System.in); System.out.println(“Please input the weight:”); bagWeight=input.nextDouble(); B b = new B(); double total = b.method(1337, bagWheight); System.out.println(“The total weight is: “+total); } … Read more

[Solved] Not sure why I am getting a StackOverflowError. Also have a yellow underline under Vector, and 1 other place in code

Calling setbounds from your reshape method would be causing stackoverflowerror. If you look at the source code of Component class the setBounds method calls the reshape method. So from your reshape method when you call super (Component) class setbounds method then from this Component setbounds method again your reshape overridden method is called which is … Read more

[Solved] How to get value from void method? [closed]

You might set your Matrix properties based on the Dimension like class Matrix implements MatrixInterface { private Integer width; private Integer height; void GetSize(Dimension dim) { this.width = dim.width; this.height = dim.height; } } // Please note that this code isn’t clean. Or maybe the Getter is in fact a Setter. class Matrix implements MatrixInterface … Read more

[Solved] Parse a date from a text file and convert the month to a number

Here is a very simple example to process your file and split the string line and obtain the date object. public class FileReaderExample { public static void main(String[] args) { File file = new File(“d:\\text.txt”); try { BufferedReader br = new BufferedReader(new FileReader(file)); String line; int lineNo = 1; while ((line = br.readLine()) != null) … Read more

[Solved] Splash screen activity not working

It’s not clear which package your SplashScreen.java lives in, but android:name=”info.androidhive.androidsplashscreentimer.SplashScreen” might need to be changed to android:name=”.SplashScreen” You may have just pasted in the manifest definition from the sample project without adjusting the activity name to match your own project. 0 solved Splash screen activity not working

[Solved] Java function doesnt work [closed]

The posted code is just fine it calls the URL http://localhost:8080/HTTP_Connection/index.php with the parameter firstKey and its value firstValue Unless you forgot to do the imports which would result in a compile error to begin with. I guess your error is on the server side. Please double check the server. For sure your question is … Read more

[Solved] Can i develop a .net project without visual studio ,if yes is .net framework is cost or freeware [duplicate]

Yes, you can develop without Visual Sturio. You could use csc or msbuild at the command line, you could use any of a range of alternative IDEs, or you could use Visual Studio Express, which is free. The .NET framework is freely available to Windows users. Alternatively if “free” and “free” isn’t good enough: Mono … Read more

[Solved] Method of overload

Just like previous question – there is no such variable number when you write acctNum = number; in public FlexibleAccount(String owner): public FlexibleAccount(String owner) { balance = 0; name=owner; Random generator = new Random(); number=generator.nextDouble(); << number is not declared this.acctNum= number; } EDIT: This is your 2nd constructor: public FlexibleAccount(double initBal, String owner, double … Read more

[Solved] JAVA: Split main into methods and put in another class? [closed]

First, try to split your code in methods: while (action != 6) { printIntro() action = getAction(); switch (action) { case 1: { contact = readContact() contacts.add(contact); try { writeContact(contact); System.out.println(“Your contact has been saved.”); } catch (IOException e) { e.printStackTrace(); } } break; etc. For splitting this thing into classes, first determine the objects … Read more