Wikipedia:Reference desk/Archives/Computing/2022 February 7
Appearance
Computing desk | ||
---|---|---|
< February 6 | << Jan | February | Mar >> | Current desk > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
February 7
[edit]In JAVA, is it possible to write all types of codes in main method?
[edit]I want to write all types of codes in main method, so that no need to instantiate the class or without having to instantiate an object.
public class Main {
public static void main(String[] args) {
int x = 5;
System.out.println(x);
}
}
I don't want to use below code to show same output:
public class Main {
int x = 5;
public static void main(String[] args) {
Main myObj = new Main();
System.out.println(myObj.x);
}
}
Rizosome (talk) 06:10, 7 February 2022 (UTC)
- Yes, this is entirely possible.
main()
can have local variables just like any other method. JIP | Talk 09:48, 7 February 2022 (UTC)
I understand very well. Rizosome (talk) 07:35, 8 February 2022 (UTC)
Resolved
- But you still haven't learned how to say "Thank you." MinorProphet (talk) 22:31, 11 February 2022 (UTC)
- Unresolved
Unzipping files
[edit]How do I unzip a file without the use of 3rd party websites? I've heard it's really easy but I'm just missing a key point. Hpnzii (talk) 16:04, 7 February 2022 (UTC)
- @Hpnzii: Depends on what OS you're using. If you're on Windows you can do it through the file explorer (Can't provide the exact steps to do so right now as I don't have access to my Windows PC) as long as it's a file in the .zip format. I can't say the same for other OSes though since I've only ever used Windows and Chrome OS (never really encountered .zip files on Chrome OS so I don't know how it works there). ― Blaze WolfTalkBlaze Wolf#6545 16:09, 7 February 2022 (UTC)
- On Windows 10, in file explorer, right-click on the file. One of the menu options is "Extract all...", which then asks you where to put the files — GhostInTheMachine talk to me 16:16, 7 February 2022 (UTC)
- You download and install one of the many file archivers. (By the way, thank you for letting me know that online decompression is a thing, as you may coincidentally just have solved my problem.) Card Zero (talk) 14:00, 9 February 2022 (UTC)