简体   繁体   中英

Add variables in Java like in PHP

Can i add variables (if that's right?) like you can do in PHP. like this:

<?php $title = 'just some title'; ?>

or:

<?php $ssid = session_id(); ?>

Is there someway i can do something like that in java?

No as Java is a strongly-typed but if you want to declare a variable to reference to any other Class object you can use Object Class.

For example:

Object title = 'just some title';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM