Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

WikiQuora

WikiQuora Logo WikiQuora Logo

WikiQuora Navigation

Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • Add group
  • Feed
  • User Profile
  • Communities
  • Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
Home/Java

WikiQuora Latest Questions

Saralyn
  • 1
SaralynTeacher
Asked: May 12, 2025

What are the possible questions asked in an interview (fresher) if you have mentioned Java in your resume?

  • 1

If they are planning to interview you specifically on JAVA, it guarantees questions about OOP. I will list a number of very common questions asked in JAVA interviews: It could be about garbage collection:

arraysinterviewJavaOops
0
  • 0 0 Answers
  • 194 Views
Answer
Saralyn
  • 1
SaralynTeacher
Asked: May 12, 2025

Between Java and Python, which one is better to learn first and why?

  • 1

If you’d have asked me a couple of years ago to write an answer to this question, I would have said, without any hesitation, that you should learn Python as a first language.

BegginerJavalanguageprogrammerpython
0
  • 0 0 Answers
  • 146 Views
Answer
Saralyn
  • 1
SaralynTeacher
Asked: May 6, 2025

How do SQL and database systems deal with timezones in date data?

  • 1

Most database engines normalize to GMT/UTC for storage (and typically store “seconds since some time 0” as timezoneless numbers in actual date or datetime/timestamp fields) and have a notion of a “default” time zone for date ...

databasedateJavaoraclesqltimetimezone
0
  • 0 0 Answers
  • 99 Views
Answer
Saralyn
  • 0
SaralynTeacher
Asked: May 1, 2025

What is the best application framework available in Java?

  • 0

HIBERNATE Hibernate is a great tool for ORM mappings in java. It can cut down a lot of complexity and thus defects as well from your application, which may otherwise find a way ...

FrameworkHibernateJavaSTRUTS
0
  • 0 0 Answers
  • 119 Views
Answer
Saralyn
  • 0
SaralynTeacher
Asked: May 1, 2025

Why am I facing error while invoking a method in Java?

  • 0

Encountering errors while invoking a method in Java can stem from several reasons:  NullPointerException:If you are calling a method on an ...

ErrorJavaMethod
0
  • 0 0 Answers
  • 106 Views
Answer
Saralyn
  • 1
SaralynTeacher
Asked: April 27, 2025

Should I learn Java or Kotlin in order to develop Android apps?

  • 1

Go Easy with Kotlin, create as many as Class in .kt but if you are having problem with, then also create some class in .java There is no issue if your app has both the classes, ...

AndroidDevelopmentJavaKotlin
  1. Saralyn
    Saralyn Teacher
    Added an answer on April 27, 2025 at 2:01 pm

    Learn Java if: ✅ You want to work on enterprise applications. ✅ You are interested in cloud computing, web services, and microservices. ✅ You prefer a well-established language with strong community support. Learn Kotlin if: ✅ You want to specialize in Android development. ✅ You prefer a modern, conRead more

    Learn Java if:

    ✅ You want to work on enterprise applications.

    ✅ You are interested in cloud computing, web services, and microservices.

    ✅ You prefer a well-established language with strong community support.

    Learn Kotlin if:

    ✅ You want to specialize in Android development.

    ✅ You prefer a modern, concise syntax.

    ✅ You want to explore functional programming & modern backend frameworks.

    Can You Learn Both?

    Yes! Java and Kotlin are interoperable, meaning you can use them together in the same project. Many companies use Java for backend and Kotlin for Android development.

    If you have time, learning both will make you a more versatile developer.

    Final Thoughts

    Both Java and Kotlin have their strengths. In 2025:

    • Java remains strong in enterprise, backend, and cloud applications.
    • Kotlin dominates Android development and is growing in backend applications.

    🚀 Best approach? Start with Java if you’re new, then explore Kotlin to expand your skill set. 🚀

    See less
      • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
1
  • 1 1 Answer
  • 431 Views
Answer
Saralyn
  • 1
SaralynTeacher
Asked: April 27, 2025

Will AI replace programmers?

  • 1

As a coder, I have some nuanced opinions about AI. I’m an applications developer / designer, and I’ve been coding since I was a teenager. My first system was a Sinclair ZX80! My ...

AIartificial intelligencecodingJavajobprogrammer
  1. Saralyn
    Best Answer
    Saralyn Teacher
    Added an answer on April 27, 2025 at 1:58 pm

    AI is getting smarter, but replacing programmers entirely? That’s not happening anytime soon. What AI Can Do AI can already generate code, debug simple problems, and automate repetitive tasks. Tools like GitHub Copilot and ChatGPT can speed up development by suggesting solutions, writing boilerplateRead more

    AI is getting smarter, but replacing programmers entirely? That’s not happening anytime soon.

    What AI Can Do

    AI can already generate code, debug simple problems, and automate repetitive tasks. Tools like GitHub Copilot and ChatGPT can speed up development by suggesting solutions, writing boilerplate code, and even fixing errors. This means junior-level, repetitive coding tasks are becoming more automated.

    What AI Can’t Do

    Programming isn’t just about writing code—it’s about solving complex problems, understanding user needs, designing scalable systems, and making strategic decisions. AI lacks:

    • Creativity & Critical Thinking – AI can write code, but it doesn’t understand why one approach is better than another.
    • Problem-Solving Skills – Real-world software development isn’t just about syntax; it’s about architecture, security, and optimization.
    • Collaboration & Communication – AI can’t talk to stakeholders, understand business goals, or lead a team.

    The Future of Programming

    Instead of replacing programmers, AI will enhance them. Future programmers will spend less time on repetitive coding and more time on high-level design, debugging, and decision-making. AI will become a powerful assistant, not a replacement.

    Who Should Be Worried?

    • Low-skill, copy-paste coders – If your job is just Googling and pasting Stack Overflow answers, AI might replace you.
    • Routine, repetitive coding jobs – Simple automation tasks are already being taken over by AI.

    Who Will Thrive?

    • Problem-solvers and architects – Those who design, analyze, and optimize systems.
    • Developers who adapt to AI tools – The best programmers will use AI to be 10x more productive.

    Bottom Line

    AI won’t replace programmers—it will replace bad programmers. The best developers will learn to work alongside AI, using it as a tool to build even better software.

    See less
      • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
1
  • 1 1 Answer
  • 436 Views
Answer
W3spoint99
  • 0
W3spoint99Begginer
Asked: January 8, 2025In: SpringBoot

How to configure port for a Spring Boot application?

  • 0

How do I configure the TCP/IP port listened on by a Spring Boot application, so it does not use the default port of 8080.

application.propertiesJavaportserverspringspringboot
  1. Saralyn
    Saralyn Teacher
    Added an answer on January 8, 2025 at 4:22 pm

    Option 1: s said in docs either set server.port as system property using command line option to jvm -Dserver.port=8090 or add application.properties in /src/main/resources/ with server.port=8090 For a random port use: server.port=0 Similarly add application.yml in /src/main/resources/ with: server:Read more

    Option 1:

    s said in docs either set server.port as system property using command line option to jvm -Dserver.port=8090 or add application.properties in /src/main/resources/ with

    server.port=8090
    

    For a random port use:

    server.port=0
    

    Similarly add application.yml in /src/main/resources/ with:

    server:
      port: 8090

    Option 2:

    You can configure the port programmatically.

    For Spring Boot 2.x.x:

    @Configuration
    public class CustomContainer implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {
      public void customize(ConfigurableServletWebServerFactory factory){
        factory.setPort(8042);
      }
    }
    

    For older versions:

    @Configuration
    public class ServletConfig {
        @Bean
        public EmbeddedServletContainerCustomizer containerCustomizer() {
            return (container -> {
                container.setPort(8012);
            });
        }
    }
    See less
      • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
1
  • 1 1 Answer
  • 303 Views
Answer
W3spoint99
  • 0
W3spoint99Begginer
Asked: January 8, 2025In: SpringBoot

How to access a value defined in the application.properties file in Spring Boot

  • 0

How can I access values provided in application.properties, like logging.level.org.springframework.web: DEBUG logging.level.org.hibernate: ERROR logging.file=${HOME}/application.log userBucket.path=${HOME}/bucket For instance, I want to access userBucket.path in my main program in a Spring Boot application.

application.propertiesJavaproperties filespringspringboot
  1. Saralyn
    Saralyn Teacher
    Added an answer on January 8, 2025 at 4:20 pm

    Option 1: You can use the @Value annotation and access the property in whichever Spring bean you're using @Value("${userBucket.path}") private String userBucketPath; The Externalized Configuration section of the Spring Boot docs, explains all the details that you might need.   Option 2: AnotherRead more

    Option 1:

    You can use the @Value annotation and access the property in whichever Spring bean you’re using

    @Value("${userBucket.path}")
    private String userBucketPath;
    

    The Externalized Configuration section of the Spring Boot docs, explains all the details that you might need.

     

    Option 2:

    Another way is injecting org.springframework.core.env.Environment to your bean.

    @Autowired
    private Environment env;
    ....
    
    public void method() {
        .....  
        String path = env.getProperty("userBucket.path");
        .....
    }
    See less
      • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
1
  • 1 1 Answer
  • 308 Views
Answer
W3spoint99
  • 0
W3spoint99Begginer
Asked: January 1, 2025In: Java

How to avoid checking for nulls in Java?

  • 0

I use x != null to avoid NullPointerException. Is there an alternative? if (x != null) { // ... }

avoidJavanullnullpointerexception
  1. Saralyn
    Saralyn Teacher
    Added an answer on January 1, 2025 at 8:28 am

    This to me sounds like a reasonably common problem that junior to intermediate developers tend to face at some point: they either don't know or don't trust the contracts they are participating in and defensively overcheck for nulls. Additionally, when writing their own code, they tend to rely on retRead more

    This to me sounds like a reasonably common problem that junior to intermediate developers tend to face at some point: they either don’t know or don’t trust the contracts they are participating in and defensively overcheck for nulls. Additionally, when writing their own code, they tend to rely on returning nulls to indicate something thus requiring the caller to check for nulls.

    To put this another way, there are two instances where null checking comes up:

    1. Where null is a valid response in terms of the contract; and
    2. Where it isn’t a valid response.

    (2) is easy. As of Java 1.7 you can use Objects.requireNonNull(foo). (If you are stuck with a previous version then assertions may be a good alternative.)

    “Proper” usage of this method would be like below. The method returns the object passed into it and throws a NullPointerException if the object is null. This means that the returned value is always non-null. The method is primarily intended for validating parameters.

    public Foo(Bar bar) {
        this.bar = Objects.requireNonNull(bar);
    }
    

    It can also be used like an assertion though since it throws an exception if the object is null. In both uses, a message can be added which will be shown in the exception. Below is using it like an assertion and providing a message.

    Objects.requireNonNull(someobject, "if someobject is null then something is wrong");
    someobject.doCalc();
    

    Generally throwing a specific exception like NullPointerException when a value is null but shouldn’t be is favorable to throwing a more general exception like AssertionError. This is the approach the Java library takes; favoring NullPointerException over IllegalArgumentException when an argument is not allowed to be null.

    (1) is a little harder. If you have no control over the code you’re calling then you’re stuck. If null is a valid response, you have to check for it.

    If it’s code that you do control, however (and this is often the case), then it’s a different story. Avoid using nulls as a response. With methods that return collections, it’s easy: return empty collections (or arrays) instead of nulls pretty much all the time.

    With non-collections it might be harder. Consider this as an example: if you have these interfaces:

    public interface Action {
      void doSomething();
    }
    
    public interface Parser {
      Action findAction(String userInput);
    }
    

    where Parser takes raw user input and finds something to do, perhaps if you’re implementing a command line interface for something. Now you might make the contract that it returns null if there’s no appropriate action. That leads the null checking you’re talking about.

    An alternative solution is to never return null and instead use the Null Object pattern:

    public class MyParser implements Parser {
      private static Action DO_NOTHING = new Action() {
        public void doSomething() { /* do nothing */ }
      };
    
      public Action findAction(String userInput) {
        // ...
        if ( /* we can't find any actions */ ) {
          return DO_NOTHING;
        }
      }
    }
    

    Compare:

    Parser parser = ParserFactory.getParser();
    if (parser == null) {
      // now what?
      // this would be an example of where null isn't (or shouldn't be) a valid response
    }
    Action action = parser.findAction(someInput);
    if (action == null) {
      // do nothing
    } else {
      action.doSomething();
    }
    

    to

    ParserFactory.getParser().findAction(someInput).doSomething();
    

    which is a much better design because it leads to more concise code.

    That said, perhaps it is entirely appropriate for the findAction() method to throw an Exception with a meaningful error message — especially in this case where you are relying on user input. It would be much better for the findAction method to throw an Exception than for the calling method to blow up with a simple NullPointerException with no explanation.

    try {
        ParserFactory.getParser().findAction(someInput).doSomething();
    } catch(ActionNotFoundException anfe) {
        userConsole.err(anfe.getMessage());
    }
    

    Or if you think the try/catch mechanism is too ugly, rather than Do Nothing your default action should provide feedback to the user.

    public Action findAction(final String userInput) {
        /* Code to return requested Action if found */
        return new Action() {
            public void doSomething() {
                userConsole.err("Action not found: " + userInput);
            }
        }
    }
    See less
      • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
1
  • 1 1 Answer
  • 264 Views
Answer
1 2

Sidebar

Ask A Question
  • Popular
  • Answers
  • W3spoint99

    What is the difference between Promises and Observables?

    • 2 Answers
  • W3spoint99

    Can't bind to 'ngModel' since it isn't a known property ...

    • 2 Answers
  • W3spoint99

    How to prevent SQL injection in PHP?

    • 1 Answer
  • Saralyn
    Saralyn added an answer Learn Java if: ✅ You want to work on enterprise applications.… April 27, 2025 at 2:01 pm
  • Saralyn
    Saralyn added an answer AI is getting smarter, but replacing programmers entirely? That’s not… April 27, 2025 at 1:58 pm
  • Saralyn
    Saralyn added an answer Both Promises and Observables provide us with abstractions that help us deal with the asynchronous nature… January 17, 2025 at 2:03 pm

Trending Tags

AI angular application.properties arrays artificial intelligence coding how Java javascript machine learning mysql nullpointerexception php programmer python reactjs spring springboot sql string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

  • About US
  • Privacy Policy
  • Questions
  • Recent Questions
  • Web Stories

© 2025 WikiQuora.Com. All Rights Reserved