JAVA

How to generate a random alpha-numeric string?

code for secure, easy



 

This works by choosing 130 bits from a cryptographically secure random bit generator, and encoding them in base-32. 128 bits is considered to be cryptographically strong, but each digit in a base 32 number can encode 5 bits, so 128 is rounded up to the next multiple of 5. This encoding is compact and efficient, with 5 random bits per character. Compare this to a random UUID, which only has 3.4 bits per character in standard layout, and only 122 random bits in total.
If you allow session identifiers to be easily guessable (too short, flawed random number generator, etc.), attackers can hijack other's sessions. Note that SecureRandom objects are expensive to initialize, so you'll want to keep one around and reuse it.


What is Difference between  ==  operator and .equals()  ?



==  tests for reference equality (whether they are the same object).
.equals()  tests for value equality (whether they are logically "equal").
Consequently, if you want to test whether two strings have the same value you should use .equals().

// These two have the same value

new String("test").equals("test") // --> true

// ... but they are not the same object
new String("test") == "test" // --> false

// ... neither are these
new String("test") == new String("test") // --> false

// ... but these are because literals are interned by
// the compiler and thus refer to the same object

"test" == "test" // --> true


You almost always want to use.equals(). In the rare situation where you know you're dealing with interned strings, you can use ==.
 

Note: equals() exactly Compares this String to another String, BUT equalsIgnoreCase() Compares this String to another String, ignoring case considerations.



 

46 comments:

  1. I want to learn everything about Java and object oriented java all, Cheat Codes Let Me Hold You (Turn Me On)

    ReplyDelete
  2. Please how do i know where to embed various script or edit the script of a plugin to my taste. Thanks

    ReplyDelete
  3. One day i will be a bad a** Jscript programmer

    ReplyDelete
  4. How do I Zip Download the whole in the template without editing it

    ReplyDelete
  5. nice blog.java is one of the most programming language. It is very useful for learn.You can also read: Java Training

    ReplyDelete
  6. It is very good blog and useful for students and developer,Thanks for sharing


    Core Java Online Training

    ReplyDelete
  7. great blog,thank you for providing such a excellent information..keep sharing more..
    java training
    java training in Hyderabad

    ReplyDelete
  8. Thanks for sharing this valuable post with us.

    Java Training in Gurgaon

    ReplyDelete
  9. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    Java training in chennai

    ReplyDelete

  10. Hi Your Blog is very nice!!

    Get All Top Interview Questions and answers PHP, Magento, laravel,Java, Dot Net, Database, Sql, Mysql, Oracle, Angularjs, Vue Js, Express js, React Js,
    Hadoop, Apache spark, Apache Scala, Tensorflow.

    Mysql Interview Questions for Experienced

    php interview questions for freshers

    php interview questions for experienced

    python interview questions for freshers

    tally interview questions and answers

    ReplyDelete
  11. samsung galaxy cases
    It's fascinating that a significant number of the bloggers to cleared up a couple of things for me and in addition giving.Most of thoughts can be decent content.The individuals to give them a decent shake to get your point and over the charge.

    ReplyDelete
  12. samsung galaxy cases
    It's fascinating that a significant number of the bloggers to cleared up a couple of things for me and in addition giving.Most of thoughts can be decent content.The individuals to give them a decent shake to get your point and over the charge.

    ReplyDelete
  13. Thanks for Sharing this blog. Squire Logic Technologies Provides Globally Authorized Certify JAVA Training in Chennai. Enroll Now! 100% Job Assistance.

    ReplyDelete
  14. Thank you for your information. It very nice article.
    Java Training in Pune

    ReplyDelete
  15. Thank you for your information. It very nice article.
    Java Training in Pune

    ReplyDelete
  16. Really great post, I simply unearthed your site and needed to say that I have truly appreciated perusing your blog entries.
    python training in chennai | python course institute in chennai

    ReplyDelete
  17. The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
    excel advanced excel training in bangalore | Devops Training in Chennai

    ReplyDelete
  18. This is a nice article here with some useful tips for those who are not used-to comment that frequently. Thanks for this helpful information I agree with all points you have given to us. I will follow all of them.
    Java training in Bangalore | Java training in Electronic city

    Java training in Bangalore | Java training in Marathahalli

    Java training in Bangalore | Java training in Btm layout

    Java training in Bangalore | Java training in Jaya nagar

    ReplyDelete
  19. Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information..
    java training in mumbai
    java course in mumbai
    java certification in mumbai

    ReplyDelete
  20. thank u for the great content.i hope u continue to provide and share such information with everyone

    https://www.searchblogspot.com/search?q=Hadoop+training+in+hyderabad

    http://www.rstrainings.com/adv-java-online-training.html

    ReplyDelete
  21. this is nice artical really blog is usefull to ever one

    ReplyDelete
  22. Good Post. I like your blog. Thanks for Sharing
    Java Course in Noida

    ReplyDelete
  23. Your Blog is very attractive and intresting . Krishna IT Training provides Online Java Training and many IT courses.Krishna IT Training is a great platform for enhance your technical skills with a quality.

    ReplyDelete
  24. Great Post,thanks for sharing such a wonderful information.
    Java Online Training Hyderabad
    Visit us: Java Online Training

    ReplyDelete
  25. Best article, very useful and explanation. Your post is extremely incredible. Thank you very much.
    Visit us: Java Online Training Hyderabad
    Visit us: Core Java Online Course

    ReplyDelete
  26. After working as a full-stack programmer in India for 5+ years, what salary will Canada's average PR holder earn?
    The full stack developer salary in India or Canada is 55-60K tops. This profession is a better choice than moving to the US. Canada's best jobs lie in government and immigration. It's not the place where the money lies, so there isn't much innovation or technology.

    ReplyDelete
  27. Great Post. Very informative. Keep Sharing!!

    Apply Now for MERN Training Classes in Noida

    For more details about the course fee, duration, classes, certification, and placement call our expert at 70-70-90-50-90

    ReplyDelete
  28. It's a very helpful article for an a Preparing for Java Developer. Discovered a source to get more information about best java coaching in lucknow

    ReplyDelete
  29. This is an awesome post. Really very informative and creative contents. Visit my website to get best Information About Best MPSC Coaching Institute in Vasai.
    Best MPSC Coaching Institute in Vasai
    Top MPSC Coaching Institute in Vasai

    ReplyDelete
  30. Need a top-notch Laravel development team? Look no further than Connect Infosoft Technologies! Our skilled Laravel developers are ready to tackle your project with expertise and precision, delivering exceptional results. Get in touch with us today for all your Laravel development needs.

    ReplyDelete

GitHub repository using Git Bash command

  To add a project to a GitHub repository using Git Bash command line, you can follow these steps: Create a new repository on GitHub by logg...