variable « main class « Java Class Q&A

Home
Java Class Q&A
1.abstract class
2.Base class
3.class hierarchy
4.class name
5.class version
6.Class.forName
7.ClassCastException
8.Clone
9.constant
10.Constructor
11.Development
12.DTO
13.encapsulation
14.equal method
15.extend Class
16.getter
17.hashcode
18.Inheritance
19.inner class
20.interface
21.main class
22.Method
23.NoClassDefFoundError
24.NoSuchMethodError
25.NoSuchMethodException
26.object reference
27.overload
28.parent class
29.Polymorphism
30.private
31.Private Field
32.Recursive
33.setter
34.Static
35.Static Class
36.subclass
37.Super
38.toString
39.Wrapper Class
Java Class Q&A » main class » variable 

1. Private variables in a class can be accessed from main in Java?    stackoverflow.com

I've recently started learning Java using JDK1.6. If this is a silly question, please excuse me. If private variables can be directly accessed by objects in main() how are they 'private'?

public class ...

3. Variables from another class won't assign to main class    java-forums.org

Hey guys. Simple program and my variables are not recognized in the main even after calling them for assignment. When I try to print out the assigned Health, Strength etc variables in Line 20 it says they are not assigned. What am i doing wrong? Java Code: package rpgmain; import java.util.Scanner; public class Main { public static void main(String args[]) { ...

5. Noob need help, how to get variable from main into a class?    forums.oracle.com

String dbdriver = "com.mysql.jdbc.Driver"; String server = "************"; String database = "*********"; String bruker = "******"; String passord = "*******"; Connection kobling = null; try { Class.forName(dbdriver).newInstance(); kobling = DriverManager.getConnection("jdbc:mysql://" + server + "/" + database, bruker, passord); } catch (Exception ex) { System.out.println("Feil! Fr ikke opprettet kontakt med databasen. "); System.out.println(ex); }

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.