Java.lang.class is a runtime representation of classes and interfaces.
Questions tagged [java.lang.class]
97 questions
                    
                    18
                    
            votes
                
                1 answer
            
        java.lang.RuntimeException: Unable to start activity ComponentInfo: java.lang.NullPointerException: storage == null
*I am trying to add items to the list view dynamically. But, I am getting a run time exception.Please help.
Is there a problem with the global variable "values"?
I tried to debug by printing the logs and I am able to see the values stored in the…
         
    
    
        Conans
        
- 461
- 1
- 4
- 14
                    11
                    
            votes
                
                3 answers
            
        Does Class.newInstance() follow the "Abstract factory" design pattern?
I have started reading Joshua Bloch's "Effective Java" (second edition). While reading item 2 (Consider a builder when faced with many constructor parameters), there is a particular statement that the author makes w.r.t the Class.newInstance()…
         
    
    
        divesh premdeep
        
- 1,070
- 3
- 16
- 28
                    9
                    
            votes
                
                2 answers
            
        Java: Subclassing a genericised class
I have a genericised class that I wish to subclass as follows:
public class SomeTable
    extends BaseTable
{
    public SomeTable(int rows, int cols)
    {
        super(rows, cols, SomeTableEntry.class);
       …  
         
    
    
        bguiz
        
- 27,371
- 47
- 154
- 243
                    9
                    
            votes
                
                2 answers
            
        NetBeans IDE 7.2.1 cannot access java.lang Fatal Error: Unable to find package java.lang in classpath or bootclasspath
I need help with android project inside NetBeans.  I Just opened project which is created in NetBeans and I have some issues with "cannot access java.lang
  Fatal Error: Unable to find package java.lang in classpath or bootclasspath"
This is sample…
         
    
    
        Nezir
        
- 6,727
- 12
- 54
- 78
                    8
                    
            votes
                
                4 answers
            
        What is the role of static keyword in importing java.lang.System class?
I don't understand the meaning of the keyword static when I import System class:
import static java.lang.System.*
I'm reading the book about Java and it's written there:
Any  import declaration that doesn't use the word static must start
  with…
         
    
    
        Green
        
- 28,742
- 61
- 158
- 247
                    6
                    
            votes
                
                3 answers
            
        (java.lang.String) cannot be applied to (java.lang.Object)
Ive a Listner class called TopicS  Im trying to call it from a gui called readMessages
When Im trying to run the class TopicS using the following method, 
   private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                     …
         
    
    
        skal
        
- 73
- 1
- 3
- 5
                    5
                    
            votes
                
                3 answers
            
        java.lang.ClassNotFoundException: org.json.JSONException
I am building a simple maven project. I used build path to add json as a third party library and also added it to web-inf library. In the end, i added the dependency in pom.xml. However, with all the effort above, i still get this exception. Any…
         
    
    
        zwlgator
        
- 81
- 1
- 1
- 5
                    5
                    
            votes
                
                3 answers
            
        Is there a list of thread-safe classes in Java?
I am trying to apply the lessons from reading Java Concurrency In Practice with regards to declaring whether classes that I write are either thread-safe or that they contain unsynchronised mutable state. I think this is a good idea because it…
         
    
    
        Matt
        
- 557
- 9
- 17
                    5
                    
            votes
                
                1 answer
            
        Trouble in eclipse: java.lang.ClassCastException
it's been two days that I constantly get an error dialog box every 45 seconds with the title of :
Multiple problems have occurred
and under it says:
java.lang.ClassCastException
and  in the details there is a repeated line which…
         
    
    
        Reza_Rg
        
- 3,345
- 7
- 32
- 48
                    4
                    
            votes
                
                1 answer
            
        .class == getClass() test fails
Here's a small code I wrote to check the (is it called reflection API? not sure) classes at runtime, however I am not getting the intended results. Here is the code:
public class Outer {
    public Outer(){
        System.out.println("Outer…
         
    
    
        Anurupa_Dey
        
- 113
- 4
- 11
                    4
                    
            votes
                
                4 answers
            
        Java: .class file and java.lang.Class
Is java.lang.Class the same as the actual .class file? i.e. is the content equivalent?
I want to send the .class over socket, and was wondering if instead of trying to find and load the actual .class file, if I could just transmit the…
         
    
    
        sivabudh
        
- 31,807
- 63
- 162
- 228
                    3
                    
            votes
                
                3 answers
            
        Jenkins -- build a job with cli results in java.lang.NullPointerException
all
I apologize if this has been asked before but I cannot find a suitable post anywhere. I am trying to build a job in my Jenkins instance using the Jenkins cli with jankins-cli.jar.
I am able to display the help information using:
java -jar…
         
    
    
        cpow
        
- 205
- 1
- 4
- 7
                    3
                    
            votes
                
                1 answer
            
        Java: Why does "Character newChar = 'c' " work if Character is a wrapper class? How come it doesn't need a constructor?
These are both fine for me:
Example 1:
Character newCharacter = 'c';
Example 2:
Character newCharacterOther = new Character('c');
But what are the differences?
In the first example, how does the Character class know to set its value to "c" without…
         
    
    
        Alexandros Kourtis
        
- 539
- 2
- 6
- 20
                    3
                    
            votes
                
                2 answers
            
        Is classOf[] in Scala 2.8 different from 2.7?
I have an interface from Java
public class IJava
{
   ...
   public java.lang.Class getType();
   ...
}
It is inherited in Scala
class CScala
{
    def getType() = classOf[Foo]
}
It worked in Scala 2.7.7. But in 2.8.0.RC1, I get
type mismatch; …
         
    
    
        redtank
        
- 61
- 5
                    2
                    
            votes
                
                2 answers
            
        Class required a bean of type 'java.lang.String' that could not be found
I try to a mailservice in Spring. I use Spring-Boot version 2.1.7.Release and amazon-sqs-java-messaging-lib version 1.0.8. 
My code looks like:
    @Service
@RequiredArgsConstructor
public class MailService {
private static final Logger logger =…
         
    
    
        Arthurofos
        
- 198
- 1
- 12